So I have two classes that I can call on redelivery in the Camel Error Handler. I have wrapped the two Processors
in a single Processor
so I can set the single Processor
as the onRedeliveryHandler
.
My question is this, if the onRedeliveryHandler
sets a state that needs to be cleaned up once the route has finished successfully, what is a good way to do this?
My route is complicated in that there are many different routes the message could end up in the success case. Right now I have each of these routes call a cleanup
route that lets the handler know of the success. This works but it seems like there should be a better way as I have two issues with this.
First, if redelivery never entered, I don't need to clean up the onRedelivery state.
Second, I have to manually add a call to the cleanup route from each of my success endpoint routes.
Is there a better / more standard way to do this?