You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Sathish T C <sa...@gmail.com> on 2011/03/05 09:02:14 UTC

Can I use both route specific errorHandler and route specific onException

Hi,

Can I use both route specific errorHandler and route specific onException in
the same route? Below is sample route.

	public void configure() {				

		from("file:D:/temp/onExceptionTest")
		.errorHandler(defaultErrorHandler()
				.handled(true)
				.log("Inside error handler.")
				.loggingLevel(LoggingLevel.WARN))
		.onException(Exception.class)
			.process(new Processor() {
				@Override
				public void process(Exchange arg0) throws Exception {
					System.out.println("This is the exception route.");		
				}
			})
			.end()
		.process(new Processor() {
			@Override
			public void process(Exchange exchange) throws Exception {
				System.out.println("Inside processor 1");
			}
		})
	}

Thanks in advance,
Sathish



--
View this message in context: http://camel.465427.n5.nabble.com/Can-I-use-both-route-specific-errorHandler-and-route-specific-onException-tp3410510p3410510.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Can I use both route specific errorHandler and route specific onException

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Why don't you just try it?
But yes you should be able to do that.

On Sat, Mar 5, 2011 at 9:02 AM, Sathish T C <sa...@gmail.com> wrote:
> Hi,
>
> Can I use both route specific errorHandler and route specific onException in
> the same route? Below is sample route.
>
>        public void configure() {
>
>                from("file:D:/temp/onExceptionTest")
>                .errorHandler(defaultErrorHandler()
>                                .handled(true)
>                                .log("Inside error handler.")
>                                .loggingLevel(LoggingLevel.WARN))
>                .onException(Exception.class)
>                        .process(new Processor() {
>                                @Override
>                                public void process(Exchange arg0) throws Exception {
>                                        System.out.println("This is the exception route.");
>                                }
>                        })
>                        .end()
>                .process(new Processor() {
>                        @Override
>                        public void process(Exchange exchange) throws Exception {
>                                System.out.println("Inside processor 1");
>                        }
>                })
>        }
>
> Thanks in advance,
> Sathish
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Can-I-use-both-route-specific-errorHandler-and-route-specific-onException-tp3410510p3410510.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/