Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • scope: global and/or per route (route scope override all global scope)
  • multiple global scope
  • triggered either always, only if completed with success, or only if failed
  • onWhen predicate to only trigger in certain situations
Info
titleOn completion runs in separate thread

The onCompletion runs in a separate thread in parallel with the original route. It is therefore not intended to influence the outcome of the original route. The idea for on completion is to spin off a new thread to eg send logs to a central log database, send an email, send alterts to a monitoring system, store a copy of the result message etc.
Therefore if you want to do some work that influence the original route, then do not use onCompletion for that. Notice: if you use the UnitOfWork API as mentioned in the top of this page, then you can register a Synchronization callback on the Exchange which is executed in the original route. That way allows you to do some custom code when the route is completed; this is how custom components can enlist on completion services which they need, eg the File component does that for work that moves/deletes the original file etc.

onCompletion with route scope

...