Defining completion actions dynamically

We have seen in the previous recipe how confirming and cancelling notifications can be defined at a route or global level, so that they can be triggered when an exchange completes processing. This is useful when that logic is tied to a single route, but how do you handle code called from multiple routes that need to do some sort of cleanup upon route completion?

This recipe will show you how to dynamically apply completion steps to an exchange's processing through the use of a Synchronization class.

This mechanism is useful when you manipulate a class of resources that need some form of post-processing in the same way. For example, Camel uses this mechanism as a part of its file consumption to move or delete ...

Get Apache Camel Developer's Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.