HornetQ,消费者找不到队列

发布于 2024-10-03 05:49:02 字数 630 浏览 0 评论 0原文

我正在尝试将 ActiveMQ-CPP 与 HornetQ 一起使用。我正在使用 ActiveMQ-CPP 捆绑示例,但我很难使用它。 生产者的工作方式就像一个魅力,但消费者给我以下消息:

* BEGIN SERVER-SIDE STACK TRACE
消息:队列/queue/exampleQueue不存在 异常类
结束服务器端堆栈跟踪*

文件:activemq/core/ActiveMQConnection.cpp,行:768
文件:activemq/core/ActiveMQConnection.cpp,行:774
文件:activemq/core/ActiveMQSession.cpp,行:350
文件:activemq/core/ActiveMQSession.cpp,行:281
完成时间 = 0.161 秒。

问题是队列存在。该代码在 ActiveMQ+Openwire 上工作正常,但在 HornetQ+STOMP 上却没有同样的运气。

有什么想法吗?

I'm trying to use ActiveMQ-CPP with HornetQ. I'm using the ActiveMQ-CPP bundled example, but I'm having a hard time with it.
The producer works like a charm, but the consumer gives me the following message:

* BEGIN SERVER-SIDE STACK TRACE
Message: Queue /queue/exampleQueue does not exist
Exception Class
END SERVER-SIDE STACK TRACE *

FILE: activemq/core/ActiveMQConnection.cpp, LINE: 768
FILE: activemq/core/ActiveMQConnection.cpp, LINE: 774
FILE: activemq/core/ActiveMQSession.cpp, LINE: 350
FILE: activemq/core/ActiveMQSession.cpp, LINE: 281
Time to completion = 0.161 seconds.

The problem is that the queue exists. The code works all right with ActiveMQ+Openwire, but I'm not having the same luck with HornetQ+STOMP.

Any ideas?

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

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

发布评论

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

评论(2

能否归途做我良人 2024-10-10 05:49:02

尝试将您在 Hornetq 上定义的相同队列地址设置为目的地。

可能您的队列是在 HornetQ 上定义的,如下所示

 <queue name="exampleQueue">
     <address>jms.queue.exampleQueue</address>
 </queue>

因此,尝试通过 STOMP 连接到该地址。

根据协议,请参阅以下框架:

订阅队列

SUBSCRIBE
destination:jms.queue.exampleQueue

^@

发送消息

SEND
destination:jms.queue.exampleQueue

it works
^@

消息发送后,您将在您订阅的会话上收到消息队列

MESSAGE
timestamp:1311355464983
redelivered:false
expires:0
subscription:subscription/jms.queue.exampleQueue
priority:0
message-id:523
destination:jms.queue.exampleQueue

it works

- 编辑

我想补充一点...

HornetQ 不符合 STOMP 的命名标准(参见 http://community.jboss.org/message/594176 ),因此 activemq-cpp 有可能遵循 ativemq-nms 的行为,它将队列的名称“规范化”为 STOMP 标准: “/queue/YourQueue”(并导致命名问题)。

因此,如果是这种情况,即使您尝试将目标名称更改为“jms.queue.exampleQueue”,activemq-cpp 也可以将其规范化为“/queue/jms.queue.exampleQueue”。

在 NMS+HornetQ 中,没有“开箱即用”的方法来避免这种情况。唯一的选择是编辑 NMS 的源代码并删除标准化队列名称的部分。也许在activemq-cpp上也是同样的方法。

Try to set the same Queue's address you defined on Hornetq as the destination.

Probably your queue is defined on HornetQ like this

 <queue name="exampleQueue">
     <address>jms.queue.exampleQueue</address>
 </queue>

So, try to connect to this address via STOMP.

See the following frames according to the protocol:

Subscribing to the queue

SUBSCRIBE
destination:jms.queue.exampleQueue

^@

Sending a message

SEND
destination:jms.queue.exampleQueue

it works
^@

As soon as the message is sent, you'll get the message on the session you subscribed to the queue

MESSAGE
timestamp:1311355464983
redelivered:false
expires:0
subscription:subscription/jms.queue.exampleQueue
priority:0
message-id:523
destination:jms.queue.exampleQueue

it works

-- EDIT

There's one point left I would like to add...

HornetQ doesn't conform to STOMP's naming standarts (see http://community.jboss.org/message/594176 ), so there's a possibility that the activemq-cpp follows the behavior of ativemq-nms, which "normalize" queue's name to the STOMP standart: "/queue/YourQueue" (and causes naming issues).

So, if that's the case, even if you try to change your destination name to 'jms.queue.exampleQueue', activemq-cpp could normalize it to '/queue/jms.queue.exampleQueue'.

In NMS+HornetQ, there's no "out of the box" way of avoiding this. The only choice is to edit NMS's source code and remove the part which normalize queue's names. Maybe it's the same way out on activemq-cpp.

无声情话 2024-10-10 05:49:02

HornetQ 不喜欢 SUBSCRIBE 的“/queue/”前缀。我从 StompHelper 的 ToStomp 方法中取出了它,一切正常。

HornetQ doesn't like the "/queue/" prefix for a SUBSCRIBE. I took that out of the ToStomp method in StompHelper and everything worked.

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