ActiveMQ + NMS无法接收消息

发布于 2024-09-06 14:41:04 字数 604 浏览 7 评论 0原文

我正在尝试从 C# 应用程序使用 ActiveMQ 主题上的消息。我使用的是 1.3 .net 版本,但没有收到任何消息。

我现有的代码使用较旧的库(以及构建在我不想使用或升级的库之上的库),工作正常,所以我知道消息正在沿着该主题传播,但我使用较新库的简单程序却无法正常工作看不见他们。

我正在使用从 http:// 复制和粘贴的代码remark.wordpress.com/articles/publish-subscribe-with-activemq-and-nms/ 作为我的测试。 SimpleTopicSubscriber(通过简单的更改使其成为非持久消费者)只是不接收任何内容。 SimpleTopicPublisher 工作得很好 - 我可以发送一条简单的消息并且它会通过,没有问题。

查看 JMX 控制台,我可以看到我的订阅者已连接,看到它位于正确的主题上,但它只是没有收到任何消息。

有什么想法吗?我什至尝试过使用 1.2 库,但这没有任何区别。

谢谢 马特

I'm trying to consume messages on an ActiveMQ topic from a C# application. I'm using the 1.3 .net release, and I don't receive any messages.

I have existing code that uses older libraries (and libraries built on top of libraries that I don't want to use or upgrade) that work fine, so I know messages are travelling along the topic, but my simple program with newer libraries just doesn't see them.

I'm using code copied and pasted from http://remark.wordpress.com/articles/publish-subscribe-with-activemq-and-nms/ as my test. The SimpleTopicSubscriber (with a simple change to make it a non-durable consumer) just doesn't receive anything. The SimpleTopicPublisher works just fine - I can send a simple message and it gets through, no problem.

Looking at the JMX console, I can see my subscriber connect, see that it's on the right topic, but it just doesn't get any messages.

Any ideas? I've even tried using the 1.2 libraries, but that didn't make any difference.

Thanks
Matt

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦在夏天 2024-09-13 14:41:04

结果发现有两个问题。我错误地编辑了示例代码,并传入了持久消费者 ID 而不是选择器。不是很聪明。

一旦解决了这个问题,我就可以接收消息,但仅限于 NMS/ActiveMq dll 的 1.1 版本。我无法接收 1.2 或 1.3 版本的消息。

但是如果我在连接时传递wireformat.version=2作为参数,一切正常。代理是 5.0.0,我强烈怀疑这可以在更高版本的代理中正常工作。

谢谢
马特

Turns out there were 2 problems. I edited the example code incorrectly and passed in a durable consumer id instead of a selector. Not terribly clever.

Once I'd fixed this, I could receive messages, but only with the 1.1 release of the NMS/ActiveMq dlls. I couldn't receive messages with version 1.2 or 1.3.

But if I pass wireformat.version=2 as a parameter when connecting, everything works ok. The broker is 5.0.0 and I strongly suspect this would work ok with a later version of the broker.

Thanks
Matt

葮薆情 2024-09-13 14:41:04

您的客户端可能无法接收消息的原因有多种,其中之一可能是您没有调用 Connection.Start(),否则消息泵将不会开始向您的客户端发送消息。另一个原因可能是您现在的非持久主题订阅者是在发布者之后启动的,在这种情况下,不会传递任何消息,因为您正在使用主题,而主题就像队列一样,一旦消息发送,它就会被遗忘,所以稍后加入的订阅者不会收到在其订阅之前发送的任何消息。

问候
蒂姆.

开源集成:http://fusesource.com

There are a couple reasons why your client might not be receiving messages, one could be that you didn't call Connection.Start(), without that the message pump won't start dispatching messages to your client. The other reason might be that your now non-durable Topic subscriber was started after the publisher in which case there'd be no messages delivered since you are using a Topic and Topics are like queue's in that once a message is sent its forgotten about so a subscriber that joins up later doesn't receive any messages that were sent before it subscribed.

Regards
Tim.

Open Source Integration: http://fusesource.com

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文