[英]artemis rest integration - unable to consume message from queue
我無法將 Artemis REST 功能集成到我的一個項目中。 更准確地說,一切都很好,直到我嘗試使用隊列中的消息。
我正在遵循文檔中提到的過程。 API 遵循 HATEOAS 原則,這意味着您基本上是通過 api 調用來實現自己的方式,這些調用返回指向 url 的超鏈接,而這些超鏈接本身並不用於進行調用。
該過程包括
工作正常,直到第 3 點。
調用端點會導致異常,抱怨要使用的消息類型不正確。 這是堆棧跟蹤:
Caused by: java.lang.RuntimeException: java.lang.IllegalArgumentException: ClientMessage must be an HTTP message or an Object message: ClientMessage[messageID=105226700092, durable=true, address=jms.queue.DLQ,userID=560c0246-e52b-11e5-82d3-4b37ae7b5e66,properties=TypedProperties[__AMQ_CID=5475aad0-e52b-11e5-82d3-4b37ae7b5e66,_AMQ_ORIG_ADDRESS=jms.queue.ExpiryQueue,_AMQ_ORIG_MESSAGE_ID=100931732707,_AMQ_ORIG_QUEUE=jms.queue.ExpiryQueue]] type: 3
at org.apache.activemq.artemis.rest.queue.QueueConsumer.pollWithIndex(QueueConsumer.java:190)
at org.apache.activemq.artemis.rest.queue.QueueConsumer.checkIndexAndPoll(QueueConsumer.java:166)
at org.apache.activemq.artemis.rest.queue.QueueConsumer.poll(QueueConsumer.java:146)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:139)
at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:295)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:249)
at org.jboss.resteasy.core.ResourceLocatorInvoker.invokeOnTargetObject(ResourceLocatorInvoker.java:138)
at org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:107)
at org.jboss.resteasy.core.ResourceLocatorInvoker.invokeOnTargetObject(ResourceLocatorInvoker.java:133)
at org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:107)
at org.jboss.resteasy.core.ResourceLocatorInvoker.invokeOnTargetObject(ResourceLocatorInvoker.java:133)
at org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:101)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395)
... 32 more
Caused by: java.lang.IllegalArgumentException: ClientMessage must be an HTTP message or an Object message: ClientMessage[messageID=105226700092, durable=true, address=jms.queue.DLQ,userID=560c0246-e52b-11e5-82d3-4b37ae7b5e66,properties=TypedProperties[__AMQ_CID=5475aad0-e52b-11e5-82d3-4b37ae7b5e66,_AMQ_ORIG_ADDRESS=jms.queue.ExpiryQueue,_AMQ_ORIG_MESSAGE_ID=100931732707,_AMQ_ORIG_QUEUE=jms.queue.ExpiryQueue]] type: 3
at org.apache.activemq.artemis.rest.queue.ConsumedMessage.createConsumedMessage(ConsumedMessage.java:63)
at org.apache.activemq.artemis.rest.queue.QueueConsumer.pollWithIndex(QueueConsumer.java:182)
... 48 more
該應用程序在 Wildfly 10 中運行,其中包括版本 1.1.0(artemis rest 版本:1.1.0)中的 Artemis。
我試圖通過請求傳遞我的消息的內容類型。 但它似乎沒有效果,無論我提供什么類型。
在這一點上,我對錯誤一無所知。 希望任何人都可以指出我正確的方向。
提前致謝,托馬斯。
我遇到了同樣的問題並解決了它:您是否嘗試為您的 Message 指定類型?
session.createMessage(ClientMessage.TEXT_TYPE, true);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.