Search code examples
apache-camelspring-camelcamel-http

Produce messages to IBM MQ using REST API. Apache Camel


I have to send messages to IBM MQ by hitting a rest service. Below is the code I came up with, using 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? I only need the post service to reply with 200, if the message is successfully produced to QUEUE, 500 otherwise. How to solve this problem?


Solution

  • Pattern of your exchange is InOut so this is default behavior for your jms producer. Try change it for specific endpoint like this:

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