繁体   English   中英

artemis 休息集成 - 无法使用队列中的消息

[英]artemis rest integration - unable to consume message from queue

我无法将 Artemis REST 功能集成到我的一个项目中。 更准确地说,一切都很好,直到我尝试使用队列中的消息。

我正在遵循文档中提到的过程。 API 遵循 HATEOAS 原则,这意味着您基本上是通过 api 调用来实现自己的方式,这些调用返回指向 url 的超链接,而这些超链接本身并不用于进行调用。

该过程包括

  1. 发布消息
  2. 创建一个拉资源来消费消息
  3. 实际上通过 pull-resource 消费消息

工作正常,直到第 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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM