activemq 无法消费! consumers are alive when the messages are stuck !

网友投稿 1104 2022-09-20

activemq 无法消费! consumers are alive when the messages are stuck !

activemq 无法消费!  consumers are alive when the messages are stuck !

我的微服务中, activemq 消费 一条消息的时候, 出了错, 结果导致了 那条消息就一直处于pending 状态,

/** * * 队列操作 */ public static void consume() throws JMSException { Session session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE); String qu = null; qu = "queue.user.545c2ed5-fee7-482a-bb59-564bbaa593f8_c5cdc461-4e9c-48c5-8684-6a81571114b8"; Queue queue = session.createQueue(qu); MessageConsumer consumer = session.createConsumer(queue); System.out.println("consumer = " + consumer); consumer.setMessageListener(new MessageListener() { @Override public void onMessage(Message message) { System.out.println("message00 ============ " + message); try { message.acknowledge(); } catch (JMSException e) { e.printStackTrace(); } } }); }

程序运行没错, 但是, 我的 MessageListener 似乎不起作用,  message00 ============  始终不打印出来.  我也是郁闷了, 这么简单的程序都有错啊, 我写过很多次的好吧,  网上疯狂搜索一把, 好像大家都是这样写的啊..  坑爹了啊..

不同于topic, queue 是可以先生产, 后面再消费的吧,,queue 并没有生产者消费者时间先后顺序的限制, 难道哪里记错了?  各种找资料, 发现并不是这样的..

难不成activemq 已经报错了? 看下日志吧:

2018-04-13 05:11:03,574 CRIT Supervisor running as root (no user in config file) 2018-04-13 05:11:03,581 WARN Included extra file "/etc/supervisor/conf.d/activemq.conf" during parsing 2018-04-13 05:11:03,581 WARN Included extra file "/etc/supervisor/conf.d/cron.conf" during parsing 2018-04-13 05:11:03,744 INFO RPC interface 'supervisor' initialized 2018-04-13 05:11:03,744 CRIT Server 'unix_running without any HTTP authentication checking 2018-04-13 05:11:03,749 INFO supervisord started with pid 1 2018-04-13 05:11:04,751 INFO spawned: 'cron' with pid 16 2018-04-13 05:11:04,753 INFO spawned: 'activemq' with pid 17 2018-04-13 05:11:06,102 INFO success: cron entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) 2018-04-13 05:11:06,102 INFO success: activemq entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) 2018-04-13 07:09:36,530 WARN received SIGTERM indicating exit request 2018-04-13 07:09:36,530 INFO waiting for cron, activemq to die 2018-04-13 07:09:37,533 INFO stopped: activemq (terminated by SIGTERM) 2018-04-13 07:09:37,534 INFO stopped: cron (terminated by SIGTERM) 2018-04-13 07:11:36,201 CRIT Supervisor running as root (no user in config file) 2018-04-13 07:11:36,201 WARN Included extra file "/etc/supervisor/conf.d/activemq.conf" during parsing 2018-04-13 07:11:36,201 WARN Included extra file "/etc/supervisor/conf.d/cron.conf" during parsing 2018-04-13 07:11:36,258 INFO RPC interface 'supervisor' initialized 2018-04-13 07:11:36,260 CRIT Server 'unix_running without any HTTP authentication checking 2018-04-13 07:11:36,260 INFO supervisord started with pid 1 2018-04-13 07:11:37,263 INFO spawned: 'cron' with pid 16 2018-04-13 07:11:37,265 INFO spawned: 'activemq' with pid 17 2018-04-13 07:11:38,737 INFO success: cron entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) 2018-04-13 07:11:38,738 INFO success: activemq entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) 2018-05-03 03:42:11,945 WARN received SIGTERM indicating exit request 2018-05-03 03:42:11,959 INFO waiting for cron, activemq to die 2018-05-03 03:42:12,971 INFO stopped: activemq (terminated by SIGTERM) 2018-05-03 03:42:12,973 INFO stopped: cron (terminated by SIGTERM) 2018-05-03 03:44:23,724 CRIT Supervisor running as root (no user in config file) 2018-05-03 03:44:23,727 WARN Included extra file "/etc/supervisor/conf.d/activemq.conf" during parsing 2018-05-03 03:44:23,728 WARN Included extra file "/etc/supervisor/conf.d/cron.conf" during parsing 2018-05-03 03:44:23,824 INFO RPC interface 'supervisor' initialized 2018-05-03 03:44:23,824 CRIT Server 'unix_running without any HTTP authentication checking 2018-05-03 03:44:23,824 INFO supervisord started with pid 1 2018-05-03 03:44:24,830 INFO spawned: 'cron' with pid 16 2018-05-03 03:44:24,831 INFO spawned: 'activemq' with pid 17 2018-05-03 03:44:26,254 INFO success: cron entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) 2018-05-03 03:44:26,254 INFO success: activemq entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) 2018-07-16 09:35:45,450 CRIT Supervisor running as root (no user in config file) 2018-07-16 09:35:45,458 WARN Included extra file "/etc/supervisor/conf.d/activemq.conf" during parsing 2018-07-16 09:35:45,458 WARN Included extra file "/etc/supervisor/conf.d/cron.conf" during parsing 2018-07-16 09:35:45,472 INFO RPC interface 'supervisor' initialized 2018-07-16 09:35:45,472 CRIT Server 'unix_running without any HTTP authentication checking 2018-07-16 09:35:45,472 INFO supervisord started with pid 1 2018-07-16 09:35:46,474 INFO spawned: 'cron' with pid 16 2018-07-16 09:35:46,475 INFO spawned: 'activemq' with pid 17 2018-07-16 09:35:47,773 INFO success: cron entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) 2018-07-16 09:35:47,773 INFO success: activemq entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

似乎也并没有上面特别的, CRIT  是什么? 好像很严重的样子, 感觉还是可以忽略的吧..

好像是版本问题唉, 难道?

: 提到

pending messages = number of messages CURRENTLY waiting for delivery in the destination (the current size of the queue) enqueued messages = number of messages that where enqueued in the destination since the last statistic reset. This number can only rise. dequeued messages = messages delivered from the destination to consumers. this number can be higher that the number of enqueued messages if a message was delivered to multiple consumers (topics).

好像并没什么卵用..

天啊, 明明两个消费者, 但是却一直不消费, 不dequeue 是几个意思?

仔细一看, 此时的消费者是2, 那就是说, 还有其他消费者?

queue.user.545c2ed5-fee7-482a-bb59-564bbaa593f8_c5cdc461-4e9c-48c5-8684-6a81571114b8 1 2 0 0

突然意识到是我的微服务还在运行, 难道它阻塞了其他消费者对当前queue的消费? 赶紧把 微服务 关闭, 再次运行上面程序,  搞定了!

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:Unix介绍
下一篇:Tushare Pro接口介绍(tushare怎么安装)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~