apache-camelactivemq-classiccamel-http

How to get the message back to the queue if the http request failed?


I use apache camel with activemq and camel-http, after the message is sent to the endpoint and the request fails, I still lose the message from the queue. It is necessary that the message is not lost if the request failed. How can I do this?

<route>
<from uri="activemq://db_record_rows"/>
<to uri="http://localhost:3000" />
</route>

Solution

  • You can mark your consumer as transacted, so it will be handled by the transaction manager of your context.

    from("activemq://db_record_rows?transacted=true")
    .to("http://localhost:3000")