You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by ravi <ra...@esq.com> on 2011/07/26 10:18:25 UTC

OnException problem

Hi i am using Camel Transactional routes like:

<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">

	<onException>
	   <exception>com.esq.org.exceptionbase.#mycustomexception#</exception>
	   <to uri="activemq:STATUSQ"/>
	</onException>

	  
	<route id = "XYZAction">
	  <from uri="activemq:XYZQ"/>
	  <to uri="XYZprocessor"/>
	</route>
	
</camelContext>

I have defined transactional camel route and using a custom processor for
messages on a queue, I want to redirect message to another queue if some
exception occur during processing. For this i m using
<onException></onException> clause. 

But the problem is that, on exception after redelivery attempts elapsed the
message is getting forward to DLQ not to the STATUSQ.






--
View this message in context: http://camel.465427.n5.nabble.com/OnException-problem-tp4634025p4634025.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: OnException problem

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Jul 26, 2011 at 10:18 AM, ravi <ra...@esq.com> wrote:
> Hi i am using Camel Transactional routes like:
>
> <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
>
>        <onException>
>           <exception>com.esq.org.exceptionbase.#mycustomexception#</exception>
>           <to uri="activemq:STATUSQ"/>
>        </onException>
>
>
>        <route id = "XYZAction">
>          <from uri="activemq:XYZQ"/>
>          <to uri="XYZprocessor"/>
>        </route>
>
> </camelContext>
>
> I have defined transactional camel route and using a custom processor for
> messages on a queue, I want to redirect message to another queue if some
> exception occur during processing. For this i m using
> <onException></onException> clause.
>
> But the problem is that, on exception after redelivery attempts elapsed the
> message is getting forward to DLQ not to the STATUSQ.
>

You need to handle the exception in the onException.

        <onException>
           <exception>com.esq.org.exceptionbase.#mycustomexception#</exception>
           <handled><constant>true</constant></handled>
           <to uri="activemq:STATUSQ"/>
        </onException>

See details at
http://camel.apache.org/exception-clause.html


>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/OnException-problem-tp4634025p4634025.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, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/