I have an instance of a job that is handled by multiple processors. All
Exchanges for this instance of a job can be identified by a value of JOB_ID
header. What is the best way to terminate processing of an instance of such
a job?

I can think of the following that needs to happen:
(1) Remove pending messages with a specified value of JOB_ID header from JMS
queue
(2) Stop all Exchanges with a specified value of JOB_ID header
(3) Application specific accounting

I was able to remove pending messages from queue(s) but I'm not sure how to
stop all Exchanges for a job. It seems this can be accomplished using
interceptors and while it's easy to add these interceptors statically I'm
not sure what is the best way to add and remove them dynamically.
Terminating instances of a job would not be common operation so I'd rather
not define interceptors statically.

I'd like to add and remove interceptor dynamically for most, if not all
routes, as I would do for a single route statically:

intercept().when(header("JOB_ID").isEqualTo(JobId)).stop();

I'm also wondering if there's a shortcut to add "global" interceptor that
applies to many if not all route definitions, be it statically or
dynamically?

Appreciate any suggestions
Andre Piwoni


--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-stop-all-Exchanges-based-on-criteria-like-header-value-tp4735364p4735364.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to