You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by cmdr <sp...@yahoo.fr> on 2008/02/28 23:00:29 UTC

Re: Camel 1.2 - CatchProcessor not working?

I think that the error is not solved.

When I use exception handler outside of a route, my errors are catched.
When I use exception handler inside of a route, my errors are not catched.

//this catch exception, I get message in my queue
//exception(SQLException.class).to("activemq:queue:SQLException");

                
//this does not work, I never get message in my queue
RouteType routeType = from(XXX);
TryType tryType = routeType.tryBlock();

tryType
.process(new Processor()
{
	public void process(Exchange exchange) throws Exception 
	{
		throw new Exception("Processing Exception");
	}
})
.to("activemq:queue:message_string");

tryType
.handle(Exception.class)
.setBody(constant("exception"))
.to("activemq:queue:SQLException");:-/

I can use the global exception handler but how to get the exception trace ?
I would like to set it has the body of my message.:confused:

cmdr
-- 
View this message in context: http://www.nabble.com/Camel-1.2---CatchProcessor-not-working--tp13405439s22882p15747053.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel 1.2 - CatchProcessor not working?

Posted by Roman Kalukiewicz <ro...@gmail.com>.
>  >  I think that the error is not solved.
>  >
>  >  When I use exception handler outside of a route, my errors are catched.
>  >  When I use exception handler inside of a route, my errors are not catched.

I've just commited a fix for this issue. Tomorrow it should be
available in our maven repository. Until then there is a set of tests
(that pass) that show the flows that are handled properly. I hope it
should solve the problem.

Different scenarios that are now handled properly could be found in
Validation* tests at
https://svn.apache.org/repos/asf/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/

Roman

Re: Camel 1.2 - CatchProcessor not working?

Posted by Roman Kalukiewicz <ro...@gmail.com>.
I noticed a lot of problems with exception handling in Camel lately
and I created an issue for this (CAMEL-346). Moreover I already have a
solution for it implemented, but I wanted to be sure that logic that I
implemented is OK as it breaks two of our JUnit tests.
I sent an email with the question, but no response so far (don't you
read camel-dev guys? ;) )
As fast I receive some answer (or timeout happens) I'll commit this
fix and close the issue.

Moreover I'll add your case to test cases to be sure, that your
problem is handled properly (so thank you for this snippet of code).

Roman


2008/2/28, cmdr <sp...@yahoo.fr>:
>
>  I think that the error is not solved.
>
>  When I use exception handler outside of a route, my errors are catched.
>  When I use exception handler inside of a route, my errors are not catched.
>
>  //this catch exception, I get message in my queue
>  //exception(SQLException.class).to("activemq:queue:SQLException");
>
>
>  //this does not work, I never get message in my queue
>  RouteType routeType = from(XXX);
>  TryType tryType = routeType.tryBlock();
>
>  tryType
>
> .process(new Processor()
>  {
>         public void process(Exchange exchange) throws Exception
>         {
>
>                 throw new Exception("Processing Exception");
>         }
>  })
>  .to("activemq:queue:message_string");
>
>  tryType
>  .handle(Exception.class)
>  .setBody(constant("exception"))
>  .to("activemq:queue:SQLException");:-/
>
>  I can use the global exception handler but how to get the exception trace ?
>  I would like to set it has the body of my message.:confused:
>
>  cmdr
>
> --
>  View this message in context: http://www.nabble.com/Camel-1.2---CatchProcessor-not-working--tp13405439s22882p15747053.html
>
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>