我想發送消息,客戶端輸入到瀏覽器使用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