我想发送消息,客户端输入到浏览器使用STOMP和ActiveMQ队列。 STOMP连接从我在控制台中读取的读数成功。我没有收到错误并正在使用该行:STOMP消息没有到达队列
stompClient.send("/queue/testQSource", {}, JSON.stringify({ 'name': name }));
在我的index.html中这样做。但是,当我输入浏览器后检查ActiveMQ控制台时,testQSource不会被添加。我是否使用正确的STOMP语法来实现此目的?我需要在HTML文件的顶部添加除STOMP源以外的任何源吗?
队列在此实例中的骆驼路线:
<from uri="jms:queue:testQSource"/>
<to uri="securityBean"/>
<log message="Routing message from testQSource to testQDestination queue with data ${body}"/>
<to uri="jms:queue:testQDestination"/>
<to uri="activationBean"/>
<log message="message: ${body}"/>
编辑
我现在打通的消息,但我收到以下警告:
WARN : org.apache.camel.component.jms.JmsBinding - Cannot determine specific JmsMessage type to use from body class. Will use generic JmsMessage. Body class: hello.HelloMessage. If you want to send a POJO then your class might need to implement java.io.Serializable, or you can force a specific type by setting the jmsMessageType option on the JMS endpoint.
我相信这是因为STOMP消息与队列和/或路由所期望的形式不同。但是,我不知道如何配置我的路线,使我可以使用我的STOMP消息。有小费吗?
的URI骆驼航线配置包含JMS但STOMP是不同的。你尝试过跺脚而不是jms吗? – Buchi