0

我正在使用 AcitveMQ 5.3。我不知道为什么我的客户挂在 send(of MessageProducer) 方法中。

这是我的情况,我有一个服务器(带有 MQ 代理),我将服务器从 1.0 升级到 2.0(MQ 代理也从 5.3 升级到 5.6)。同时,由于 MQ 代理重新启动,客户端收到“中断”通知和“恢复”通知。在“简历”中,我将客户端状态发送到服务器并且它挂起。

我有10个客户,其中两个有上述情况。我在向代理发送消息时尝试重新启动 MQ 代理。(与上述类似的场景。)但是,很难重现。

有没有人有过这样的经历?挂在 MessageProducer 方法的发送中?

谢谢。


更新:这里是步骤,

  1. 经纪人和客户版本是 5.3

  2. 卸载代理并安装 5.6 代理。

    ==> 如您所说,经纪人和客户之间的版本不匹配。版本不匹配会导致问题吗?但它应该具有向后兼容性,对吧?

  3. 我将得到 TransportListener 的 Interrupted 和 Resume 方法

  4. 我做了一些连接恢复任务,还在 Resume 调用中向代理发送了一条消息

    ==> 正如您所提到的,在 Resume 呼叫中发送消息是危险的。但是,我们一直这样做,以前从未遇到过此类问题。

  5. 我的程序将挂在 MessageProducer 发送中。

这更清楚吗?代码到处都是分开的,不容易贴出来。

谢谢。


更新第 2 部分,

I move MessageProducer send to another thread, but I wait in Resume callback of TransportListener until sending done. In this scenario, it always hangs on sending a message. However, "sending a message in Resume callback directly" hangs occasionally. These two scenario is quite similar. Why are they so different? I dug in the source code(ActiveMQ-Cpp 3.4.5), but i didn't find any special things. or I dug in wrong files? I really want to know it's mechanism.

BTW, before "update part2", i'm using java version MQ. But the result seems no difference between java and cpp. So, at "update part2", i'm using ActiveMQ-CPP 3.4.5 as my library.

Thanks.

4

1 回答 1

0

Its a bit unclear what your setup is, are the clients and broker versions matched or not? If not then the problem is most likely related to that.

Some code would be helpful here. But I think what you are saying is that you send a message to the broker during the TransportListener method resumed() call. This can be dangerous as you are looping back into the Transport layer from the same thread which generally lead to issues as these events aren't really meant to be places where you send messages etc but more for an update point which can allow you to kick off a new thread or activity to deal with connection recovery.

Hanging in MessageProducer send can be triggered in the case of Producer flow control kicking in as well but I'm not convinced this is happening in your case but without further clarification of you question its hard to say for sure.

于 2013-04-08T17:11:16.227 回答