[jira] Created: (CAMEL-860) DeadLetterChannel does not set the EXCEPTION_CAUSE_PROPERTY

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] Created: (CAMEL-860) DeadLetterChannel does not set the EXCEPTION_CAUSE_PROPERTY

JIRA jira@apache.org
DeadLetterChannel does not set the EXCEPTION_CAUSE_PROPERTY
-----------------------------------------------------------

                 Key: CAMEL-860
                 URL: https://issues.apache.org/activemq/browse/CAMEL-860
             Project: Apache Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 1.4.0
         Environment: Windows XP,  JDK 6
            Reporter: dario sanna


The DeadLetterChannel does not set the EXCEPTION_CAUSE_PROPERTY.

It looks like a bug in the method:
public boolean process(final Exchange exchange, final AsyncCallback callback, final RedeliveryData data)

The property is set by getting the Exception from the exchange:
exchange.setProperty(EXCEPTION_CAUSE_PROPERTY, exchange.getException());

but several lines before the Exception ist set to null in exchange:
if (exchange.getException() != null) {
                Throwable e = exchange.getException();
                exchange.setException(null); // Reset it since we are handling it.

to fix the bug, i think it is simply done by preserving the Throwable like this
Throwable e = exchange.getException();
if (exchange.getException() != null) {
                exchange.setException(null); // Reset it since we are handling it.
...
exchange.setProperty(EXCEPTION_CAUSE_PROPERTY, e);



--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Assigned: (CAMEL-860) DeadLetterChannel does not set the EXCEPTION_CAUSE_PROPERTY

JIRA jira@apache.org

     [ https://issues.apache.org/activemq/browse/CAMEL-860?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen reassigned CAMEL-860:
---------------------------------

    Assignee: Claus Ibsen

> DeadLetterChannel does not set the EXCEPTION_CAUSE_PROPERTY
> -----------------------------------------------------------
>
>                 Key: CAMEL-860
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-860
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 1.4.0
>         Environment: Windows XP,  JDK 6
>            Reporter: dario sanna
>            Assignee: Claus Ibsen
>   Original Estimate: 5 minutes
>  Remaining Estimate: 5 minutes
>
> The DeadLetterChannel does not set the EXCEPTION_CAUSE_PROPERTY.
> It looks like a bug in the method:
> public boolean process(final Exchange exchange, final AsyncCallback callback, final RedeliveryData data)
> The property is set by getting the Exception from the exchange:
> exchange.setProperty(EXCEPTION_CAUSE_PROPERTY, exchange.getException());
> but several lines before the Exception ist set to null in exchange:
> if (exchange.getException() != null) {
>                 Throwable e = exchange.getException();
>                 exchange.setException(null); // Reset it since we are handling it.
> to fix the bug, i think it is simply done by preserving the Throwable like this
> Throwable e = exchange.getException();
> if (exchange.getException() != null) {
>                 exchange.setException(null); // Reset it since we are handling it.
> ...
> exchange.setProperty(EXCEPTION_CAUSE_PROPERTY, e);

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (CAMEL-860) DeadLetterChannel does not set the EXCEPTION_CAUSE_PROPERTY

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

    [ https://issues.apache.org/activemq/browse/CAMEL-860?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45206#action_45206 ]

Claus Ibsen commented on CAMEL-860:
-----------------------------------

Thanks for the report.

I looked into it and yes the code is a bit "tricky" in the DLC. It actually restores the exception in the incrementRedeliveryCounter method.

However I feel the code could be a bit more "less surprising" so I am re factoring it a bit (based on your suggestions)

> DeadLetterChannel does not set the EXCEPTION_CAUSE_PROPERTY
> -----------------------------------------------------------
>
>                 Key: CAMEL-860
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-860
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 1.4.0
>         Environment: Windows XP,  JDK 6
>            Reporter: dario sanna
>            Assignee: Claus Ibsen
>   Original Estimate: 5 minutes
>  Remaining Estimate: 5 minutes
>
> The DeadLetterChannel does not set the EXCEPTION_CAUSE_PROPERTY.
> It looks like a bug in the method:
> public boolean process(final Exchange exchange, final AsyncCallback callback, final RedeliveryData data)
> The property is set by getting the Exception from the exchange:
> exchange.setProperty(EXCEPTION_CAUSE_PROPERTY, exchange.getException());
> but several lines before the Exception ist set to null in exchange:
> if (exchange.getException() != null) {
>                 Throwable e = exchange.getException();
>                 exchange.setException(null); // Reset it since we are handling it.
> to fix the bug, i think it is simply done by preserving the Throwable like this
> Throwable e = exchange.getException();
> if (exchange.getException() != null) {
>                 exchange.setException(null); // Reset it since we are handling it.
> ...
> exchange.setProperty(EXCEPTION_CAUSE_PROPERTY, e);

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Resolved: (CAMEL-860) DeadLetterChannel does not set the EXCEPTION_CAUSE_PROPERTY

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

     [ https://issues.apache.org/activemq/browse/CAMEL-860?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-860.
-------------------------------

    Fix Version/s: 1.5.0
       Resolution: Fixed

> DeadLetterChannel does not set the EXCEPTION_CAUSE_PROPERTY
> -----------------------------------------------------------
>
>                 Key: CAMEL-860
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-860
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 1.4.0
>         Environment: Windows XP,  JDK 6
>            Reporter: dario sanna
>            Assignee: Claus Ibsen
>             Fix For: 1.5.0
>
>   Original Estimate: 5 minutes
>  Remaining Estimate: 5 minutes
>
> The DeadLetterChannel does not set the EXCEPTION_CAUSE_PROPERTY.
> It looks like a bug in the method:
> public boolean process(final Exchange exchange, final AsyncCallback callback, final RedeliveryData data)
> The property is set by getting the Exception from the exchange:
> exchange.setProperty(EXCEPTION_CAUSE_PROPERTY, exchange.getException());
> but several lines before the Exception ist set to null in exchange:
> if (exchange.getException() != null) {
>                 Throwable e = exchange.getException();
>                 exchange.setException(null); // Reset it since we are handling it.
> to fix the bug, i think it is simply done by preserving the Throwable like this
> Throwable e = exchange.getException();
> if (exchange.getException() != null) {
>                 exchange.setException(null); // Reset it since we are handling it.
> ...
> exchange.setProperty(EXCEPTION_CAUSE_PROPERTY, e);

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Reopened: (CAMEL-860) DeadLetterChannel does not set the EXCEPTION_CAUSE_PROPERTY

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

     [ https://issues.apache.org/activemq/browse/CAMEL-860?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

dario sanna reopened CAMEL-860:
-------------------------------


The fix does not work, the property is not set.
Example code :

from("file:/data").convertBodyTo(String.class)
.errorHandler(deadLetterChannel("myjms:dead").maximumRedeliveries(2).useExponentialBackOff())
.setHeader("xyz", xquery("wrong xquery {}").asString())
.to("direct:blabla");

The use case is:
in case of an exchange-failure, the cause should be visible in the dead-letter-channel, for later investigate.

 

> DeadLetterChannel does not set the EXCEPTION_CAUSE_PROPERTY
> -----------------------------------------------------------
>
>                 Key: CAMEL-860
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-860
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 1.4.0
>         Environment: Windows XP,  JDK 6
>            Reporter: dario sanna
>            Assignee: Claus Ibsen
>             Fix For: 1.5.0
>
>   Original Estimate: 5 minutes
>  Remaining Estimate: 5 minutes
>
> The DeadLetterChannel does not set the EXCEPTION_CAUSE_PROPERTY.
> It looks like a bug in the method:
> public boolean process(final Exchange exchange, final AsyncCallback callback, final RedeliveryData data)
> The property is set by getting the Exception from the exchange:
> exchange.setProperty(EXCEPTION_CAUSE_PROPERTY, exchange.getException());
> but several lines before the Exception ist set to null in exchange:
> if (exchange.getException() != null) {
>                 Throwable e = exchange.getException();
>                 exchange.setException(null); // Reset it since we are handling it.
> to fix the bug, i think it is simply done by preserving the Throwable like this
> Throwable e = exchange.getException();
> if (exchange.getException() != null) {
>                 exchange.setException(null); // Reset it since we are handling it.
> ...
> exchange.setProperty(EXCEPTION_CAUSE_PROPERTY, e);

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (CAMEL-860) DeadLetterChannel does not set the EXCEPTION_CAUSE_PROPERTY

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

    [ https://issues.apache.org/activemq/browse/CAMEL-860?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45250#action_45250 ]

Claus Ibsen commented on CAMEL-860:
-----------------------------------

Dario it is working as exepected. I have added some more unit test to verify that the original caused exception is on the exchange.

However I can see what your problem is. You DLC is a *jms* queue. And the JMS spec doesn't allow to send complex objects as properties on a JMSMessage. So the exception object is lost when its send to the JMS queue, only the body and simple properties is sent.

The issue is that we need the JMS producer to send the entire exchange as an object to the JMS queue.
I will create a ticket for this feature in JIRA.

> DeadLetterChannel does not set the EXCEPTION_CAUSE_PROPERTY
> -----------------------------------------------------------
>
>                 Key: CAMEL-860
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-860
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 1.4.0
>         Environment: Windows XP,  JDK 6
>            Reporter: dario sanna
>            Assignee: Claus Ibsen
>             Fix For: 1.5.0
>
>   Original Estimate: 5 minutes
>  Remaining Estimate: 5 minutes
>
> The DeadLetterChannel does not set the EXCEPTION_CAUSE_PROPERTY.
> It looks like a bug in the method:
> public boolean process(final Exchange exchange, final AsyncCallback callback, final RedeliveryData data)
> The property is set by getting the Exception from the exchange:
> exchange.setProperty(EXCEPTION_CAUSE_PROPERTY, exchange.getException());
> but several lines before the Exception ist set to null in exchange:
> if (exchange.getException() != null) {
>                 Throwable e = exchange.getException();
>                 exchange.setException(null); // Reset it since we are handling it.
> to fix the bug, i think it is simply done by preserving the Throwable like this
> Throwable e = exchange.getException();
> if (exchange.getException() != null) {
>                 exchange.setException(null); // Reset it since we are handling it.
> ...
> exchange.setProperty(EXCEPTION_CAUSE_PROPERTY, e);

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Resolved: (CAMEL-860) DeadLetterChannel does not set the EXCEPTION_CAUSE_PROPERTY

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

     [ https://issues.apache.org/activemq/browse/CAMEL-860?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-860.
-------------------------------

    Resolution: Fixed

See CAMEL-870 about the use of jms for DLC queues.

> DeadLetterChannel does not set the EXCEPTION_CAUSE_PROPERTY
> -----------------------------------------------------------
>
>                 Key: CAMEL-860
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-860
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 1.4.0
>         Environment: Windows XP,  JDK 6
>            Reporter: dario sanna
>            Assignee: Claus Ibsen
>             Fix For: 1.5.0
>
>   Original Estimate: 5 minutes
>  Remaining Estimate: 5 minutes
>
> The DeadLetterChannel does not set the EXCEPTION_CAUSE_PROPERTY.
> It looks like a bug in the method:
> public boolean process(final Exchange exchange, final AsyncCallback callback, final RedeliveryData data)
> The property is set by getting the Exception from the exchange:
> exchange.setProperty(EXCEPTION_CAUSE_PROPERTY, exchange.getException());
> but several lines before the Exception ist set to null in exchange:
> if (exchange.getException() != null) {
>                 Throwable e = exchange.getException();
>                 exchange.setException(null); // Reset it since we are handling it.
> to fix the bug, i think it is simply done by preserving the Throwable like this
> Throwable e = exchange.getException();
> if (exchange.getException() != null) {
>                 exchange.setException(null); // Reset it since we are handling it.
> ...
> exchange.setProperty(EXCEPTION_CAUSE_PROPERTY, e);

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Closed: (CAMEL-860) DeadLetterChannel does not set the EXCEPTION_CAUSE_PROPERTY

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

     [ https://issues.apache.org/activemq/browse/CAMEL-860?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dario Sanna closed CAMEL-860.
-----------------------------


Thank you for the explanation, i think i have to dive deeper in Apache Camel ...
Many thanks!
With best regards, Dario

> DeadLetterChannel does not set the EXCEPTION_CAUSE_PROPERTY
> -----------------------------------------------------------
>
>                 Key: CAMEL-860
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-860
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 1.4.0
>         Environment: Windows XP,  JDK 6
>            Reporter: Dario Sanna
>            Assignee: Claus Ibsen
>             Fix For: 1.5.0
>
>   Original Estimate: 5 minutes
>  Remaining Estimate: 5 minutes
>
> The DeadLetterChannel does not set the EXCEPTION_CAUSE_PROPERTY.
> It looks like a bug in the method:
> public boolean process(final Exchange exchange, final AsyncCallback callback, final RedeliveryData data)
> The property is set by getting the Exception from the exchange:
> exchange.setProperty(EXCEPTION_CAUSE_PROPERTY, exchange.getException());
> but several lines before the Exception ist set to null in exchange:
> if (exchange.getException() != null) {
>                 Throwable e = exchange.getException();
>                 exchange.setException(null); // Reset it since we are handling it.
> to fix the bug, i think it is simply done by preserving the Throwable like this
> Throwable e = exchange.getException();
> if (exchange.getException() != null) {
>                 exchange.setException(null); // Reset it since we are handling it.
> ...
> exchange.setProperty(EXCEPTION_CAUSE_PROPERTY, e);

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.