HornetQ,消费者找不到队列
我正在尝试将 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试将您在 Hornetq 上定义的相同队列地址设置为目的地。
可能您的队列是在 HornetQ 上定义的,如下所示
因此,尝试通过 STOMP 连接到该地址。
根据协议,请参阅以下框架:
订阅队列
发送消息
消息发送后,您将在您订阅的会话上收到消息队列
- 编辑
我想补充一点...
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
So, try to connect to this address via STOMP.
See the following frames according to the protocol:
Subscribing to the queue
Sending a message
As soon as the message is sent, you'll get the message on the session you subscribed to the queue
-- 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.
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.