Hi

This is my reply from the Fuse forum
http://fusesource.com/forums/thread.jspa?threadID=3256&tstart=0



If you use JMS then the JMS broker has built in support for error
queues (dead letter channel). So its in fact better to use that,
instead of having Camel sending the message back to the error queue.
Then all that is handled within the broker.

See chapter 9 in the Camel in Action book.

The Apache ActiveMQ web site have a few details as well
http://activemq.apache.org/message-redelivery-and-dlq-handling.html

Then you dont need to use the onException at all.


On Wed, Aug 17, 2011 at 3:29 PM, Claus Ibsen <claus.ib...@gmail.com> wrote:
> Posted to this forum as well
> http://fusesource.com/forums/thread.jspa?threadID=3256&tstart=0
>
> Where this is already being discussed.
>
> On Wed, Aug 17, 2011 at 3:24 PM, rschetti <rschett...@verizon.net> wrote:
>> Experienced Camel Users,
>>
>> I am a relatively new Camel user. I have successfully setup the "happy case"
>> where Camel (using transactions) is routing messages through multiple JMS
>> queues. Now it's time to add some error handling...
>>
>> I use a UnitOfWork to manage updates to the file system (almost exactly as
>> described in "Camel in Action" chapter 9). When the Camel route succeeds, I
>> create a file. When the route fails, the file is deleted. The UnitOfWork
>> operates as expected when exceptions are thrown from my Processors and
>> caught by Camel.
>>
>> My problems occur when I add onException() to my DSL to catch and handle any
>> exceptions manually. On an exception, I would like to redirect the errant
>> message to an "error queue"
>>
>> onException(Exception.class).handled(true).to("myErrorQueue").end()
>>
>> By stating handled(true), Camel believes that the route was successful, and
>> the onComplete() method is called on the elements of the UnitOfWork. In my
>> case, I don't want that to happen, I want the UnitOfWork to call
>> onFailure().
>>
>> I tried using handled(false). In this case, the onFailure() method was
>> applied to the elements of the UnitOfWork, but Camel did not route the
>> errant message to "myErrorQueue". Instead, Camel retried processing the
>> message 6 times (the default # of retries) and then moved the message to the
>> DeadLetterQueue.
>>
>> So I'm stuck. How can I combine onException() to handle the errors, but
>> still have the UnitOfWork treat the exceptions as "failures"?
>>
>> Any assistance would be greatly appreciated.
>>
>>
>>
>>
>>
>>
>> --
>> View this message in context: 
>> http://camel.465427.n5.nabble.com/Mixing-UnitOfWork-Synchronization-and-onException-Handling-tp4708180p4708180.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cib...@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>



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

Reply via email to