简体   繁体   English

服务器闲置几个小时后,ActiveMQ停止接收消息

[英]ActiveMQ stops receiving messages after servers left idle for few hours

I've been browsing the forums for last few days and tried almost everything i could find, but without any luck. 我最近几天一直在浏览论坛,并尝试了几乎所有我能找到的东西,但没有运气。

The situation is: inside our Java Web Application we have ActiveMQ 5.7 (I know it's very old, eventually we will upgrade to newer version - but for some reasons it's not possible right now). 情况是:在我们的Java Web应用程序中,我们有ActiveMQ 5.7(我知道它已经很老了,最终我们将升级到更新的版本 - 但由于某些原因,现在不可能)。 We have only one broker and multiple consumers. 我们只有一个经纪人和多个消费者。

When I start the servers (I have tried to do so for 2, 3, 4 and more servers) everything is ok. 当我启动服务器时(我已尝试为2,3,4和更多服务器执行此操作)一切正常。 The servers are comunicating with each other, QUEUE messages are consumed instantly. 服务器相互通信,即时消耗QUEUE消息。 But when I leave the servers idle (for example to finally catch some sleep ;) ) it is no longer the case. 但是,当我让服务器空闲时(例如最终要抓住一些睡眠;))就不再是这样了。 Messages are stuck in the database and are not beign consumed. 消息卡在数据库中,不会消耗掉。 The only option to have them delivered is to restart the server. 将它们交付的唯一选择是重新启动服务器。

Part of my configuration (we keep it in properties file, it's the actual state, however I have tried many different combinations): 我的部分配置(我们将其保存在属性文件中,它是实际状态,但我尝试了许多不同的组合):

BrokerServiceURI=broker:(tcp://0.0.0.0:{0})/{1}?persistent=true&useJmx=false&populateJMSXUserID=false&useShutdownHook=false&deleteAllMessagesOnStartup=false&enableStatistics=true 
ConnectionFactoryURI=failover://({0})?initialReconnectDelay=100&timeout=6000 
ConnectionFactoryServerURI=tcp://{0}:{1}?keepAlive=true&soTimeout=100&wireFormat.cacheEnabled=false&wireFormat.tightEncodingEnabled=false&wireFormat.maxInactivityDuration=0 
BrokerService.startAsync=true 
BrokerService.networkConnectorStartAsync=true 
BrokerService.keepDurableSubsActive=false

Do you have a clue? 你有线索吗?

I cannot actually tell you the reason from the description mentioned above but I can list down a few checks that are fresh in my mind. 我实际上无法从上面提到的描述中告诉你原因,但我可以列出一些在我脑海中新鲜的检查。 Please confirm the following if they are valid for you or not. 如果它们对您有效,请确认以下内容。

  1. Can you check the consumer connections? 你能检查消费者的联系吗?
  2. Are the consumer sessions still active? 消费者会话仍然有效吗?
  3. If all the consumer-connections are up, then check the thread-dump whether the active consumer threads (I'm assuming you created consumer threads, correct me if I'm wrong) are in RUNNING or WAITING state(this happened with me where all the consumers were active but some other thread was keeping a lock on Logger while posting a message to slack and the consumers were in WAITING state) because of some other thread in the server). 如果所有的消费者连接都已启动,那么检查线程转储是否活动的消费者线程(我假设你创建了消费者线程,如果我错了就纠正我)处于RUNNING或WAITING状态(这发生在我身边所有的消费者都是活跃的,但是其他一些线程在保持对Logger的锁定,同时发布消息为松弛并且消费者处于WAITING状态)因为服务器中的某些其他线程)。
  4. Check the Dispatch queue size for each consumer. 检查每个使用者的Dispatch队列大小。 Check the prefetch of each consumer and then compare Dispatch Queue size with Prefetch, refer 检查每个使用者的预取,然后将Dispatch Queue size与Prefetch进行比较, 参考
  5. Is there a JMSXGroupID you are allotting to each message? 是否有分配给每条消息的JMSXGroupID?

Can you tell a little more about your consumer/producer/broker configurations? 您能告诉我们您的消费者/生产者/经纪人配置吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM