2016-08-16 53 views
1

我在將Artemis REST功能集成到我的項目之一時遇到問題。更確切地說,一切都很好,直到我試圖從隊列中消費一條消息。artemis休息集成 - 無法使用隊列中的消息

我正在按照文檔中提到的過程。 API遵循HATEOAS原則,這意味着您基本上可以通過api調用 ,它們將超鏈接返回到本身不是用來撥打電話的網址。

的方法,包括

  1. 發佈消息
  2. 創建一個拉資源消耗的消息
  3. 實際上是通過拉資源消耗消息

正常工作,直到點3.

調用端點導致異常,抱怨t要消費的消息不是正確的類型。這裏是堆棧跟蹤:

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其餘版本:1.1.0)。

我試圖通過請求傳遞消息的內容類型。但它似乎沒有效果,無論什麼類型的供應。

在這一點上,我對這個錯誤非常無知。希望任何人都能指引我走向正確的方向。

在此先感謝,托馬斯。

回答

0

我有同樣的問題,並解決它: 你有沒有試圖給你的消息類型?

session.createMessage(ClientMessage.TEXT_TYPE, true);