I am trying to setup a C client to talk to a hornetq jms server. I am using its STOMP acceptor with libstomp on the C side.
My C client code is just this example from the libstomp page verbatim with the passphrase and destination queue name changed (to a valid queue that can be accessed from a java client).
Here's what I get when I run it:
Connecting......OK
Sending connect message.OK
Reading Response.Response: CONNECTED,
OK
Sending Subscribe.OK
Sending Message.OK
Reading Response.Response: ERROR, org.hornetq.core.protocol.stomp.StompException: Client must set destination or id head
er to a SUBSCRIBE command
at org.hornetq.core.protocol.stomp.StompProtocolManager.onSubscribe(StompProtocolManager.java: 339)
at org.hornetq.core.protocol.stomp.StompProtocolManager.handleBuffer(StompProtocolManager.java:196)
at org.hornetq.core.protocol.stomp.StompConnection.bufferReceived(StompConnection.java:279)
at org.hornetq.core.remoting.server.impl.RemotingServiceImpl$DelegatingBufferHandler.bufferRec eived(RemotingServ
iceImpl.java:512)
at org.hornetq.core.remoting.impl.netty.HornetQChannelHandler.messageReceived(HornetQChannelHa ndler.java:73)
at org.jboss.netty.channel.SimpleChannelHandler.handleUpstream(SimpleChannelHandler.java:100)
at org.jboss.netty.channel.StaticChannelPipeline.sendUpstream(StaticChannelPipeline.java:372)
at org.jboss.netty.channel.StaticChannelPipeline.sendUpstream(StaticChannelPipeline.java:367)
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:274)
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:261)
at org.jboss.netty.channel.socket.oio.OioWorker.run(OioWorker.java:100)
at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:44)
at org.jboss.netty.util.VirtualExecutorService$ChildExecutorRunnable.run(VirtualExecutorServic e.java:181)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
OK
Sending Disconnect.OK
Disconnecting...OK
In short - I get this exception from the server:
ERROR, org.hornetq.core.protocol.stomp.StompException: Client must set destination or id header to a SUBSCRIBE command
On line 92 of the example, we set the destination:
apr_hash_set(frame.headers, "destination", APR_HASH_KEY_STRING, "/queue/FOO.BAR");
Despite this, when the message gets to the server and it parses the headers, I get a map ation -> /queue/FOO.BAR
, but it's looking for a destination
key. I have confirmed that the client is adding the correct map entry to the headers and it is not corrupted all the way through to sending it to the network.
Any pointers as to what might be wrong?
P.S. hornetq is 2.2.9.Final, libstomp is the latest revision from svn (rev 90 - http://svn.codehaus.org/stomp/trunk/c/), and it was compiled with apr 1.4.6; all running on Win-7
2.2.9 is a pretty old HornetQ release. You should retry with 2.2.14, or with the latest 2.3.beta. I just looked at the code in git for HornetQ master, the destination is being handled
See onSubscribe() at https://github.com/hornetq/hornetq/blob/master/hornetq-server/src/main/java/org/hornetq/core/protocol/stomp/VersionedStompFrameHandler.java#L254
FWIW, in HornetQ a dot .
is used as divisor for destinations (your code is using a slash /
). The STOMP protocol leaves this as an implementation dependent convention.