ActiveMQ异步统计信息接收 [英] ActiveMQ async statistics receiving
问题描述
我面临一个非常常见的错误,但仍然没有找到解决方案.我正在使用异步消息发送:
I am facing a pretty common error, but still haven't found a solution for it. I am using async message sending:
Queue adminQueue=session.createQueue("admin_queue");
MessageConsumer mc=session.createConsumer(adminQueue);
mc.setMessageListener(new AdminListener(emfMaster,ps));
connection.start();
this.statisticProvider = new AdminStats(adminQueue, mc, session);
我需要使用ActiveMQ的状态插件来接收统计信息,该插件已填充到我的AdminStats类中(它启动了一个用于接收统计信息的新线程),但它仍然告诉我,我只能使用同步消息发送,而不指定MessageListener.
And I need to receive statstics for it, using a Stat Plugin for ActiveMQ, which is stuffed into my AdminStats class(it starts a new thread for receiving stats), but still it tells, that I can use only sync message sending, not specifying the MessageListener.
[javax.jms.IllegalStateException: Cannot synchronously receive a message when a MessageListener is set]
我无权更改邮件的发送方式.有什么方法可以异步获取统计信息?
I have no right to change the way messages are sent. Is there any way to get the stats in async way?
推荐答案
您可以使用JMX获取统计信息.或带有咨询性消息.来自此处的一些链接: http://activemq.apache.org/how- can-i-monitor-activemq.html
You can get stats using JMX. Or with advisory messages. Some links from here: http://activemq.apache.org/how-can-i-monitor-activemq.html
这篇关于ActiveMQ异步统计信息接收的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!