You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by radisb <ra...@gmail.com> on 2008/12/16 01:08:23 UTC
Cast a copy message to an endpoint when exception is thrown
Hello.
First of all thanks for the great framework.
My question is this:
After reading all this posts about transactions I understand that it is
backing system's responsibility to handle redeliveries.
But what if I just want send a copy of a message to an endpoint everytime a
redelivery occurs?
To be more specific here is a snippet:
from("transactedActiveMq:sourceQ").policy(ApropagationRequiredPolicy).process(AnExceptionThrowingProcessor);
Now I want to let backing system do its work on redelivery and delays but I
want to get notified every time an exception occurs, for example to send to
an endpoint or a queue a copy of the message that was "inside" processor
when exception fired. How could i do this?
Thanks a lot,
Bill
--
View this message in context: http://www.nabble.com/Cast-a-copy-message-to-an-endpoint-when-exception-is-thrown-tp21024810s22882p21024810.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Cast a copy message to an endpoint when exception is thrown
Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Dec 16, 2008 at 9:37 PM, radisb <ra...@gmail.com> wrote:
>
> Claus, this works only if I have not put policy in the route. I think it is
> due to the hidden feature of transactions with deadletter when policy is not
> put in the route. I ll search more.
Yeah that is correct it's the DeadLetterChannel that handles the
onException as well. So this is another use-case for supporting
enabling DLC as a kind of orchestrator even for transacted exchanges.
For instance the handled=true is thus not being able to kick in as
well.
>
>
> Claus Ibsen-2 wrote:
>>
>> Hi
>>
>> The error handler stuff is not to easy to spot in the wiki:
>> http://activemq.apache.org/camel/error-handler.html
>>
>> Using the exception clause:
>> http://activemq.apache.org/camel/exception-clause.html
>>
>> Should let you be able to send a message somewhere when an exception is
>> thrown
>>
>> onException(Exception.class).to("seda:damm")
>> from("transactedActiveMq:sourceQ").policy(ApropagationRequiredPolicy).process(AnExceptionThrowingProcessor);
>>
>> Then when an exception occurs it's send to the seda queue damm and
>> proceeded, and thus the backing system should get the exception as
>> well and do it's rollback.
>>
>> But the seda queue is not part of the TX so the message should stay there.
>>
>>
>> On Tue, Dec 16, 2008 at 1:08 AM, radisb <ra...@gmail.com> wrote:
>>>
>>> Hello.
>>> First of all thanks for the great framework.
>>>
>>> My question is this:
>>> After reading all this posts about transactions I understand that it is
>>> backing system's responsibility to handle redeliveries.
>>> But what if I just want send a copy of a message to an endpoint everytime
>>> a
>>> redelivery occurs?
>>> To be more specific here is a snippet:
>>>
>>> from("transactedActiveMq:sourceQ").policy(ApropagationRequiredPolicy).process(AnExceptionThrowingProcessor);
>>>
>>> Now I want to let backing system do its work on redelivery and delays but
>>> I
>>> want to get notified every time an exception occurs, for example to send
>>> to
>>> an endpoint or a queue a copy of the message that was "inside" processor
>>> when exception fired. How could i do this?
>>>
>>> Thanks a lot,
>>> Bill
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Cast-a-copy-message-to-an-endpoint-when-exception-is-thrown-tp21024810s22882p21024810.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>>
>> /Claus Ibsen
>> Apache Camel Committer
>> Blog: http://davsclaus.blogspot.com/
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Cast-a-copy-message-to-an-endpoint-when-exception-is-thrown-tp21024810s22882p21041271.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
--
/Claus Ibsen
Apache Camel Committer
Blog: http://davsclaus.blogspot.com/
Re: Cast a copy message to an endpoint when exception is thrown
Posted by radisb <ra...@gmail.com>.
Claus, this works only if I have not put policy in the route. I think it is
due to the hidden feature of transactions with deadletter when policy is not
put in the route. I ll search more.
Claus Ibsen-2 wrote:
>
> Hi
>
> The error handler stuff is not to easy to spot in the wiki:
> http://activemq.apache.org/camel/error-handler.html
>
> Using the exception clause:
> http://activemq.apache.org/camel/exception-clause.html
>
> Should let you be able to send a message somewhere when an exception is
> thrown
>
> onException(Exception.class).to("seda:damm")
> from("transactedActiveMq:sourceQ").policy(ApropagationRequiredPolicy).process(AnExceptionThrowingProcessor);
>
> Then when an exception occurs it's send to the seda queue damm and
> proceeded, and thus the backing system should get the exception as
> well and do it's rollback.
>
> But the seda queue is not part of the TX so the message should stay there.
>
>
> On Tue, Dec 16, 2008 at 1:08 AM, radisb <ra...@gmail.com> wrote:
>>
>> Hello.
>> First of all thanks for the great framework.
>>
>> My question is this:
>> After reading all this posts about transactions I understand that it is
>> backing system's responsibility to handle redeliveries.
>> But what if I just want send a copy of a message to an endpoint everytime
>> a
>> redelivery occurs?
>> To be more specific here is a snippet:
>>
>> from("transactedActiveMq:sourceQ").policy(ApropagationRequiredPolicy).process(AnExceptionThrowingProcessor);
>>
>> Now I want to let backing system do its work on redelivery and delays but
>> I
>> want to get notified every time an exception occurs, for example to send
>> to
>> an endpoint or a queue a copy of the message that was "inside" processor
>> when exception fired. How could i do this?
>>
>> Thanks a lot,
>> Bill
>> --
>> View this message in context:
>> http://www.nabble.com/Cast-a-copy-message-to-an-endpoint-when-exception-is-thrown-tp21024810s22882p21024810.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>
>
>
> --
>
> /Claus Ibsen
> Apache Camel Committer
> Blog: http://davsclaus.blogspot.com/
>
>
--
View this message in context: http://www.nabble.com/Cast-a-copy-message-to-an-endpoint-when-exception-is-thrown-tp21024810s22882p21041271.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Cast a copy message to an endpoint when exception is thrown
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
The error handler stuff is not to easy to spot in the wiki:
http://activemq.apache.org/camel/error-handler.html
Using the exception clause:
http://activemq.apache.org/camel/exception-clause.html
Should let you be able to send a message somewhere when an exception is thrown
onException(Exception.class).to("seda:damm")
from("transactedActiveMq:sourceQ").policy(ApropagationRequiredPolicy).process(AnExceptionThrowingProcessor);
Then when an exception occurs it's send to the seda queue damm and
proceeded, and thus the backing system should get the exception as
well and do it's rollback.
But the seda queue is not part of the TX so the message should stay there.
On Tue, Dec 16, 2008 at 1:08 AM, radisb <ra...@gmail.com> wrote:
>
> Hello.
> First of all thanks for the great framework.
>
> My question is this:
> After reading all this posts about transactions I understand that it is
> backing system's responsibility to handle redeliveries.
> But what if I just want send a copy of a message to an endpoint everytime a
> redelivery occurs?
> To be more specific here is a snippet:
>
> from("transactedActiveMq:sourceQ").policy(ApropagationRequiredPolicy).process(AnExceptionThrowingProcessor);
>
> Now I want to let backing system do its work on redelivery and delays but I
> want to get notified every time an exception occurs, for example to send to
> an endpoint or a queue a copy of the message that was "inside" processor
> when exception fired. How could i do this?
>
> Thanks a lot,
> Bill
> --
> View this message in context: http://www.nabble.com/Cast-a-copy-message-to-an-endpoint-when-exception-is-thrown-tp21024810s22882p21024810.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
--
/Claus Ibsen
Apache Camel Committer
Blog: http://davsclaus.blogspot.com/