On Mon, Apr 6, 2009 at 10:12 PM, greenbean <kevin.urci...@ngc.com> wrote:
>
> I would like to capture the exception that caused an ActiveMQ rollback when
> using Apache Camel.  I would also like to associate it with the message (by
> message id?) so that I can find the exception again when I am processing the
> message in an ActiveMQ DLQ.
>
> What is the best way to accomplish this with Apache Camel?  Currently I am
> using bean components that are abstracted from JMS.  Without Camel I would
> catch the exception in onMessage and write it out along with the message id
> found in the Message object.  I don't really have this option when dealing
> with bean components.
>
> Is there a way to place an interceptor in the ActiveMQ or transaction
> components to let me capture the exception and JMS message id on rollback?
Hi

You can use the try .. catch style as the routing is transacted then
it should be marked for rollback, the (*) rehtrow might not be needed,
but if having it it more clearly state the intention like we will do
in regular java code.

from(jms) -> policy(required) -> tryBlock -> do your routing here ->
handle(Exception.class) -> log exception and message id -> (*) rethrow
->  end

Note:
In Camel 2.0 we have a new rollback DSL keyword you can use as well.
And the onException also works with the transacted error handler in Camel 2.0.





>
> Thanks.
> --
> View this message in context: 
> http://www.nabble.com/Capturing-Exception-Causing-ActiveMQ-Rollback-tp22916317p22916317.html
> Sent from the Camel - Users (activemq) 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
Apache Camel Reference Card:
http://refcardz.dzone.com/refcardz/enterprise-integration

Reply via email to