I'm having trouble integrating the Artemis REST functionality into one of my projects. To be more precisely, everything is fine, until I'm trying to consume a message from a queue.
I'm following the process mentioned in the docs. The API follows the HATEOAS principle, which means that you are basically making your way through api calls which return hyperlinks to urls which themselves are than used to make calls.
The process, consisting of
- publishing a message
- create a pull-resource to consume messages
- actually consume message through the pull-resource
works fine until point 3.
Invoking the endpoint results in an exception, complaining that the message to consume has not the right type. Here is the stacktrace:
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
The application runs inside a wildfly 10, which includes Artemis in Version 1.1.0 (artemis rest version: 1.1.0).
I tried to deliver the content type of my message with the request. But it seems to have no effect, no matter what type im supplying.
At this point, I'm pretty clueless concerning the error. Hope anyone can point me into the right direction.
Thanks in advance, Tomas.