camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jpcook <jonathan.c...@erars.plus.com>
Subject Re: onException
Date Wed, 14 Oct 2009 07:54:31 GMT

So I read here that you can do nexted sub route exception handling: Not sure
if that is what I want.
http://www.nabble.com/onException-for-a-particular-route-td20702640.html#a20702640

So if I have a my own route builder class extending from RouteBuilder with
something like:

        @Override
	public void configure() throws Exception {		
		from("seda:start")
        	.to("seda:a", "seda:b");			
		
		configureResultsA();		
                configureResultsB();
	}

private void configureResultsA() throws Exception{
        from("seda:a")
          .process(someprocessing)
          .to("uniqueseda:a");

       from("uniqueseda:a")
           .exception(Exception.class).to("log:UNDELIVERABLE").end()
           .process(somemoreprocessing);			        	
}

private void configureResultsB() throws Exception{
        from("seda:b")
          .process(someprocessing)
          .to("uniqueseda:b");

       from("uniqueseda:b")           
           .process(somemoreprocessing);			        	
}

So want to explicitly handle all Exceptions in our own way in
configureResultsA() but just have the default behaviour in
configureResultsB() where it retries redelivery 5 times or even add some
different handling.

I think there is some confusion over what 'per route' is meaning, is that
per route builder class or everytime you use from(...) which is was it
appears like from the examples.

Hope that makes sense? We are not using Camel 2 yet either.

Thanks


Claus Ibsen-2 wrote:
> 
> On Tue, Oct 13, 2009 at 6:13 PM, jpcook <jonathan.cook@erars.plus.com>
> wrote:
>>
>> Hello,
>>
>> I was reading this page: http://camel.apache.org/exception-clause.html
>>
>> But I'm still not clear if you can have different exception policies for
>> different configure methods in the same route? The different configure
>> methods are reading from different seda queues so it seem from looking at
>> the examples that this would be possible?
>>
> 
> What do you mean with different configure methods?
> 
> Exception polices is scope based so you can define them
> - globally
> - per route
> 
> Where per route will overrule global.
> 
> So you can do
> 
> from("seda:foo").onException(MyException.class).maximumRedeliveries(3).to("bean:foo");
> 
> from("seda:bar").onException(MyOtherException.class,
> MyThridException.class).maximumRedeliveries(2).redeliveryDelay(3000).to("bean:bar");
> 
> 
>> Thanks
>> --
>> View this message in context:
>> http://www.nabble.com/onException-tp25875985p25875985.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> Claus Ibsen
> Apache Camel Committer
> 
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> 
> 

-- 
View this message in context: http://www.nabble.com/onException-tp25875985p25886803.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message