简体   繁体   中英

Camel: RabbitMQ to SOAP : requeue

I am learning Apache camel and trying to send request from RabbitMQ endpoint to some soap service :

<camelcontext>
route 1 from file:// to rabbitmq queue 
<route id="2">
<from uri="same queue as in route 1"/>
<process "here i am setting header "/>
<pattern>InOut</pattern>
<to uri="soap request"/>
</camelcontext>

What I want is that in case there is any exception at SOAP, exchange should be requeued back to rabbitmq. I have tried setting header of exchange rabbitmq.REQUEUE to true still no luck, message gets removed even though there is exception. I have tried setting exchange to InOUT too. Please suggest any pointer.

To catch an exception coming back from calling the SOAP service you could use an onException to catch the fault and then route it to rabbitMQ queue like this:

onException(Fault.class).handled(true)
    .to("rabbitmq:queue-name")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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