Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top