Don,

Let me re-state your suggestion because I'm not sure I've got it right.

(1) Add Processor that creates header "StopFlag". 

I assume you refer to Processor that handles/consumes requests to stop
specific instance of a job based on desired conditions and not the
interceptor processor wrapped in InterceptStrategy?

(2) Add when(header("StopFlag").isNotNull()).stop() to my route
definition(s). I also assume that you don't mean using "when" predicate with
route interceptor?

If my assumptions are correct than this solution aims at handling various
stop conditions but deferring actual termination of Exchange at the route
level because not every route may need to stop Exchange even when stop
condition is included. 

In step (2) I still would have to know specific JOB_ID because I need to
stop one of many Exchanges going through the route. This could happen with
bean for "when" predicate that evaluates dynamic criteria, not just
"StopFlag", but this means that Processor in step 1 has to share this info
with such bean.

In all, it seems that in order to terminate processing of an exchange as
soon as possible I need to use either InterceptStrategy or interceptor for
route definition; otherwise,  as I mentioned earlier, there's no guarantee
that termination request occurs before "regular" (non-interceptor) predicate
is evaluated.

I guess I can implement some terminate exchange InterceptStrategy with a
List of Predicate conditions that can be added and removed dynamically and
have InterceptStrategy implement Processor that consumes requests for
termination etc. and manages conditions. Alternatively, I could implement
all this with interceptor for route in step 2.

Thanks,
Andre

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

Reply via email to