Hi All, I need to solve following scenario with camel:
While message is being processed in route, I need to record certain information based on content being processed. At the end of processing this information have to be written to a storage (as a KPI event), clean-up executed regardless of success / failure of message. During route processing errors with remote components are handled by error handler which uses JMS-based retry mechanism. So far I was able to implement what I need with mixture of onCompletion elements per route and custom error handler. Unfortunately, I do have problem with behavior of onCompletion - it is asynchronous, which makes integration tests quite tough (e.g. I can not rely on order of events being generated, clean-up / event writing logic did not finish when pipeline is 'complete'). My option would be that onCompletion section would be executed on the same thread that process pipeline and producer used to post message to pipeline won't return until both logic within pipeline and onCompletion completes. During my struggle with this scenario I've also tried try / finally logic, unfortunately to find that try / finally completely disables error handler (and since I used finally-only clause exception itself was not handled and error handler was not called). It is possible that this is just a mis-behavior of 2.4.0, then I will try upgrading to more recent one. Thanks in advance. -- View this message in context: http://camel.465427.n5.nabble.com/Error-handling-and-invoking-certain-logic-unconditionally-tp5643480p5643480.html Sent from the Camel - Users mailing list archive at Nabble.com.