[英]How to monitor JMS queue within Spring application?
I am currently develop a JMS module for a spring application, now i need a simple page to monitor the traffic within the queue. 我目前正在为Spring应用程序开发JMS模块,现在我需要一个简单的页面来监视队列中的流量。
From this page from ActiveMQ I found how to bind a broker inside the application but it lack of the details about how to integrate it with Spring MVC and any API available about it. 从ActiveMQ的此页面中,我发现了如何在应用程序内绑定代理,但是缺少有关如何将其与Spring MVC以及任何可用的API集成的详细信息。 Please give a hint.
请给个提示。
Check this method. 检查此方法。
public String checkQueue(String queue) {
return jmsTemplate.browse(queue, (session, browser) -> {
Enumeration<?> messages = browser.getEnumeration();
int total = 0;
while (messages.hasMoreElements()) {
messages.nextElement();
total++;
}
return String.format("Total '%d elements waiting in %s", total, queue);
});
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.