我正在尝试设置一个 C 客户端来与 hornetq jms 服务器通信。我在 C 端使用它的 STOMP 接受器和 libstomp。
我的 C 客户端代码只是libstomp 页面中的这个示例,其中密码和目标队列名称已更改(更改为可以从 java 客户端访问的有效队列)。
这是我运行它时得到的结果:
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
简而言之 - 我从服务器得到这个异常:
ERROR, org.hornetq.core.protocol.stomp.StompException: Client must set destination or id header to a SUBSCRIBE command
在示例的第 92 行,我们设置了目的地:
apr_hash_set(frame.headers, "destination", APR_HASH_KEY_STRING, "/queue/FOO.BAR");
尽管如此,当消息到达服务器并解析标头时,我得到一个 map ation -> /queue/FOO.BAR
,但它正在寻找一个destination
密钥。我已经确认客户端正在将正确的映射条目添加到标头中,并且在将其发送到网络的整个过程中都没有损坏。
关于可能出现什么问题的任何指示?
PS hornetq 是 2.2.9.Final,libstomp 是 svn 的最新版本(rev 90 - http://svn.codehaus.org/stomp/trunk/c/),它是用 apr 1.4.6 编译的;全部在 Win-7 上运行