ActiveMQ Consumer Hangs

廉价感情. 提交于 2019-12-18 12:02:07

问题


I have an activeMQ broker using an SSL transport. I have about 10 consumers that are using the broker. I am using camel to configure my routes.

Every so often, it hangs up and will not consume new messages, even if I restart the consumers, even though there are messages pending in the queues.

I started trying to isolate where this was happening by stepping through my consumers one at a time trying to replicate the problem. I finally got to a consumer that I could re-create the problem on. It will hang after a period of time, however, if I go to the active MQ admin console and try to view messages in the queue, it will start running again. I think that Jetty is causing a connection to happen to refresh the queue for the webpage, and thus unblocking some thread problem I am having. How should I debug this?

Thanks


回答1:


A colleague of mine stumbled onto something interesting, and I just found an explanation on the internet: http://activemq.2283324.n4.nabble.com/Consumer-is-not-able-to-pick-messages-from-queue-td2531722.html

Apparently there is a page size that can get filled when you have a selector and all the messages are in the same queue. This was happening for us - I hadn't started the consumer, so I ended up with a full page of messages with selectors for a different consumer, and this was causing my running consumer to not get any additional work sent to it.




回答2:


try setting the queue prefetch to 1 to promote better distribution across consumers and reduce 'stuck' messages on specific consumers

see http://activemq.apache.org/what-is-the-prefetch-limit-for.html




回答3:


Too late for you, but I had the same problem and the problem was that I was trying to add things to the queue using the same connection I was using to take things off of the queue.

Once I separated them (two completely different contexts, one for producing and the other for consuming), the problem resolved itself.



来源:https://stackoverflow.com/questions/10017721/activemq-consumer-hangs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!