camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Outram <>
Subject Re: Exception based routing
Date Thu, 09 Aug 2007 12:20:02 GMT

James.Strachan wrote:
> Am just wondering the semantics of onPattern() really; as when I first
> read your suggestion, in my mind I was thinking that onPattern() would
> setup an interceptor. So maybe onPattern() needs some kind of
> proceed() call in part of its route to indicate if/when it carries on
> processing?
> e.g. how about this (making a slight change to the language)...
> onIntercept(anyPredicateGoesHere).to("seda:a").filter(somethingElse).proceed();
> from("seda:foo").to("seda:b");
> i.e. in the above we intercept the route, if the message matches
> anyPredicateGoesHere, then its sent to "seda:a" and if somethingElse
> matches, then it carries on to "seda:b". So it could go to "seda:a",
> "seda:b" or both - depending on the evaluation of the two predicates.
> If you really just want it to go to "seda:a" or "seda:b" then you'd just
> do...
> onIntercept(anyPredicateGoesHere).to("seda:a");
> from("seda:foo").to("seda:b");
> In both cases really, we're just putting Message Filter / Content
> Based Router inside an interceptor; rather than in-place inside the
> route (and allowing the default behaviour of interceptors to be
> inherited on all child nodes of the DSL, so the interceptor would be
> applied around all Processors in the chain).
> How's that sound?

                .when(somethingElse).to("seda:b", “seda:c”) 
                .when(somethingElseAgain).to("seda:d", proceed());

from("seda:foo").process(new Enricher1()). process(new

After from("seda:foo") or process(new Enricher1()) or process(new
Enricher2()) if the message matches anyPredicateGoesHere then send to
seda:a, if the message matches somethinElse then send it to seda:b and
seda:c, if the message matches somethingElseAgain send it to seda:d and
proceed on the current route, otherwise in all other cases just proceed; you
could include an explicit otherwise clause but as this catches everything it
would make your route pretty redundant.



… after any processing on the route if the xpath matches then send the
message to mock:result and proceed on the original route…

and even:


Basically the onIntercept() applies the following message routing rules to
all processes on routes it is registered with.

If you really wanted to have fun you could have:


Which would only apply the intercept to processors matching the

Thoughts? Am I raving ;-)


View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message