|
Say I have the following route defined in XML:
<route> <from uri="seda:start" /> <process ref="myProcessorA" /> <process ref="myProcessorB" /> <to uri="seda:end" /> <route> If the myProcessorA processor recognizes that a message it's processing doesn't make business sense, what could it do to prevent the message from going any further in the route? - aaron |
|
Hi Aaron
You could set the fault message to end up message processing in "myProcessorA". Here is a code snippet. from("start").process(new Processor() { public void process(Exchange exchange) throws Exception { Message message = exchange.getFault(); message.setBody("it doesn't make business sense"); } }); Willem Aaron Crickenberger wrote: > Say I have the following route defined in XML: > > <route> > <from uri="seda:start" /> > <process ref="myProcessorA" /> > <process ref="myProcessorB" /> > <to uri="seda:end" /> > <route> > > If the myProcessorA processor recognizes that a message it's > processing doesn't make business sense, what could it do to prevent > the message from going any further in the route? > > - aaron > |
|
In reply to this post by Aaron Crickenberger
Throw an exception?
On 20/03/2008, Aaron Crickenberger <[hidden email]> wrote: > Say I have the following route defined in XML: > > <route> > <from uri="seda:start" /> > <process ref="myProcessorA" /> > <process ref="myProcessorB" /> > <to uri="seda:end" /> > <route> > > If the myProcessorA processor recognizes that a message it's > processing doesn't make business sense, what could it do to prevent > the message from going any further in the route? > > > - aaron > -- James ------- http://macstrac.blogspot.com/ Open Source Integration http://open.iona.com |
|
Willem's solution may get me by for now, although I agree that
throwing an exception makes the most sense. The reason I asked was to see if there was any other commonly accepted solution for this scenario. Throwing an exception will send the message to Camel's default DeadLetterChannel, which will cause the message to be redelivered to myProcessorA at least 5 times. It stops the message from going any further in the route, true, but it's very noisy, and the message eventually ends up in the log. Can I customize this behavior via XML? (eg: customize DLC, or intercept the message before arriving there) Last time I checked, this was still a feature not yet ported from the DSL. - aaron On Mar 20, 2008, at 11:08 AM, James Strachan wrote: > Throw an exception? > > On 20/03/2008, Aaron Crickenberger > <[hidden email]> wrote: >> Say I have the following route defined in XML: >> >> <route> >> <from uri="seda:start" /> >> <process ref="myProcessorA" /> >> <process ref="myProcessorB" /> >> <to uri="seda:end" /> >> <route> >> >> If the myProcessorA processor recognizes that a message it's >> processing doesn't make business sense, what could it do to prevent >> the message from going any further in the route? >> >> >> - aaron >> > > > -- > James > ------- > http://macstrac.blogspot.com/ > > Open Source Integration > http://open.iona.com |
|
On 20/03/2008, Aaron Crickenberger <[hidden email]> wrote:
> Willem's solution may get me by for now, although I agree that > throwing an exception makes the most sense. The reason I asked was to > see if there was any other commonly accepted solution for this scenario. > > Throwing an exception will send the message to Camel's default > DeadLetterChannel, which will cause the message to be redelivered to > myProcessorA at least 5 times. It stops the message from going any > further in the route, true, but it's very noisy, and the message > eventually ends up in the log. Can I customize this behavior via XML? > (eg: customize DLC, or intercept the message before arriving there) > Last time I checked, this was still a feature not yet ported from the > DSL. I guess another option would be to add some interceptor within a route to customize things. e.g. rather than 'fail' mark a message as 'done' or 'not valid' or something, so normal content based routing can be used without hitting the error handling code? -- James ------- http://macstrac.blogspot.com/ Open Source Integration http://open.iona.com |
| Powered by Nabble | Edit this page |
