简体   繁体   English

使用 REST API 向 IBM MQ 生成消息。 阿帕奇骆驼

[英]Produce messages to IBM MQ using REST API. Apache Camel

I have to send messages to IBM MQ by hitting a rest service.我必须通过点击休息服务向 IBM MQ 发送消息。 Below is the code I came up with, using Camel XML DSL.下面是我想出的代码,使用 Camel XML DSL。

<rest path="/basePath">
    <post uri="/path" consumes="application/xml" produces="application/xml">
        <to uri="ibmmq:QUEUE.NAME"/>
    </post>
</rest>

When I try to post the message, I get the following exception当我尝试发布消息时,出现以下异常

org.apache.camel.RuntimeExchangeException: Failed to resolve replyTo destination on the exchange

Is the post method expecting response back from QUEUE, so that it can respond back to rest client? post 方法是否期望从 QUEUE 返回响应,以便它可以响应其余客户端? I only need the post service to reply with 200, if the message is successfully produced to QUEUE, 500 otherwise.我只需要 post 服务回复 200,如果消息成功生成到 QUEUE,否则 500。 How to solve this problem?如何解决这个问题呢?

Pattern of your exchange is InOut so this is default behavior for your jms producer.你的交换模式是 InOut 所以这是你的 jms 生产者的默认行为。 Try change it for specific endpoint like this:尝试为特定端点更改它,如下所示:

<to uri="ibmmq:QUEUE.NAME" pattern="InOnly"/>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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