On Sun, Apr 19, 2009 at 10:47 PM, Frank Schwarz <[email protected]> wrote:
>
> For the record: I switched to Camel 2.0 M1 which provides this feature.
Hi

Yeah you beat me to it this morning. I had your mail starred.

Are you using 2.0M1 or 2.0-SNAPSHOT?

1)
In the latter we recently reworked the error handling. The
TransactedErrorHandler now also supports exception clauses.
This allows you to do the

     onException(MyWhateverException.class).handled(true).to("jms:queue:foo")

and thus indicate that whenever this exception happens it should be
handled and not regard it as an exception and route it elsewhere.
And the underlying spring TX manager will not get it marked as rollback.

2)
PS: You could do this in Camel 1.x as well known as the "trick" with
the DeadLetterChannel. Where you could not add the policy(required)
and rely on the REQUIRED default propagation behaviour in Spring TX
manager.

3)
Another solution would be mirroring the try .. catch java style. But
if you have many steps you need to wrap that around each step. Or if
you can pinpoint out where this exception usually occurs you can just
use it there only

from("jms:queue"foo)
  .transacted()
  .doTry()
     .to("bean:myBean")
   .doCatch(MySuperException.class)
      // handled in doCatch is not yet supported but it will later
today as I am working on it
      .handled(true)
      .to("bean:other");
    .end();

4)
Another approach could be adding your own interceptor and there check
for the exception and remove it from exchange by
exchange.setException(null)
This could work in 1.x as well.

Something like:
interceptor().process(new MyCheckForExceptionProcessor().proceed();

// and then your regular routes here
from("jms:queue:foo")...


>
> -- Frank
>
>
>
> Frank Schwarz wrote:
>>
>> Hi,
>>
>> is there a way to let Camel consume poisoned (unprocessable) messages? I
>> haven't had any luck so far.
>>
>>
>
> --
> View this message in context: 
> http://www.nabble.com/Processing-poisoned-messages-tp23112839p23127230.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