You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Christian Mueller <ch...@gmail.com> on 2010/09/29 23:00:05 UTC

Loosing headers by using errorHandler and useOriginalMessage() in camel.jms

Hello list,

we are using camel-jms in conjunction with custom headers and the
useOriginalMessage() definition in our error handler for our exception
handling. We realized, that we loose all our headers in our dead letter
channel (using Camel 2.2.0.fuse-02-00). Our configuration looks like this
one:

errorHandler(
    deadLetterChannel("jms:queue:dead")
    .useOriginalMessage());

from("jms:queue:foo")
.processRef("allwaysThrowExceptionProcessor")
.to("jms:queue:bar");

We digg this problem down to the DefaultUnitOfWork [1], which doesn't copy
the headers if the message is a JmsMessage. The documentation says:
//cannot copy headers with a JmsMessage as the underlying javax.jms.Message
object goes nuts

Two line above, the java doc also says:
// TODO: the copy on facade strategy will help us here in the future
// TODO: optimize to only copy original message if enabled to do so in the
route
// special for JmsMessage as it can cause it to loose headers later.
// This will be resolved when we get the message facade with copy on write
implemented 

I have two questions:
1) How we can prevent or work around this (copy the original message into a
custom header and do not use useOriginalMessage(). And restore the original
message in the error flow from this custom header)?
2) When do you plan to fix this as the java doc suggests?


[1]
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultUnitOfWork.java?view=markup

Cheers,
Christian

-- 
View this message in context: http://camel.465427.n5.nabble.com/Loosing-headers-by-using-errorHandler-and-useOriginalMessage-in-camel-jms-tp3046234p3046234.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Loosing headers by using errorHandler and useOriginalMessage() in camel.jms

Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Jun 27, 2012 at 12:06 PM, get1974 <er...@teseling.net> wrote:
> Thanks for your quick response. If I understand you correctly it was already
> fixed in newer version? If so I think we simple need to upgrade, which is a
> good idea anyway. Can you confirm whether this was fixed in the current
> production release?
>

Ask the computer, give the release a try and see if it works for you.
The JIRA ticket will indicate the release number its been fixed in.


> --
> View this message in context: http://camel.465427.n5.nabble.com/Loosing-headers-by-using-errorHandler-and-useOriginalMessage-in-camel-jms-tp3046234p5715152.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



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

Re: Loosing headers by using errorHandler and useOriginalMessage() in camel.jms

Posted by get1974 <er...@teseling.net>.
Thanks for your quick response. If I understand you correctly it was already
fixed in newer version? If so I think we simple need to upgrade, which is a
good idea anyway. Can you confirm whether this was fixed in the current
production release?

--
View this message in context: http://camel.465427.n5.nabble.com/Loosing-headers-by-using-errorHandler-and-useOriginalMessage-in-camel-jms-tp3046234p5715152.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Loosing headers by using errorHandler and useOriginalMessage() in camel.jms

Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Jun 27, 2012 at 11:57 AM, get1974 <er...@teseling.net> wrote:
> Hello Claus,
>
> I also have the case that we seem to loose the headers when forwarding to a
> retry queue using the errorhandler and useOriginalMessage. Zince we do not
> use the latest version I was wondering whether this was already fixed in de
> current version (we are on 2.4) or will this be fixed in 3.0? If you have
> any simple workarounds that would be helpful!
>

Camel 2.4 is not really maintained anymore from ASF.
You can patch the code yourself, eg the JIRA tracker has a subversion
commit tab, where you can see the code changes.

Or get in touch with a vendor who may want to support Camel 2.4 for you.


> Thanks!
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Loosing-headers-by-using-errorHandler-and-useOriginalMessage-in-camel-jms-tp3046234p5715147.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



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

Re: Loosing headers by using errorHandler and useOriginalMessage() in camel.jms

Posted by get1974 <er...@teseling.net>.
Hello Claus,

I also have the case that we seem to loose the headers when forwarding to a
retry queue using the errorhandler and useOriginalMessage. Zince we do not
use the latest version I was wondering whether this was already fixed in de
current version (we are on 2.4) or will this be fixed in 3.0? If you have
any simple workarounds that would be helpful!

Thanks!

--
View this message in context: http://camel.465427.n5.nabble.com/Loosing-headers-by-using-errorHandler-and-useOriginalMessage-in-camel-jms-tp3046234p5715147.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Loosing headers by using errorHandler and useOriginalMessage() in camel.jms

Posted by Claus Ibsen <cl...@gmail.com>.
This will be fixed in Camel 3.0 when we work on some internals in Camel.


On Wed, Sep 29, 2010 at 11:00 PM, Christian Mueller
<ch...@gmail.com> wrote:
>
> Hello list,
>
> we are using camel-jms in conjunction with custom headers and the
> useOriginalMessage() definition in our error handler for our exception
> handling. We realized, that we loose all our headers in our dead letter
> channel (using Camel 2.2.0.fuse-02-00). Our configuration looks like this
> one:
>
> errorHandler(
>    deadLetterChannel("jms:queue:dead")
>    .useOriginalMessage());
>
> from("jms:queue:foo")
> .processRef("allwaysThrowExceptionProcessor")
> .to("jms:queue:bar");
>
> We digg this problem down to the DefaultUnitOfWork [1], which doesn't copy
> the headers if the message is a JmsMessage. The documentation says:
> //cannot copy headers with a JmsMessage as the underlying javax.jms.Message
> object goes nuts
>
> Two line above, the java doc also says:
> // TODO: the copy on facade strategy will help us here in the future
> // TODO: optimize to only copy original message if enabled to do so in the
> route
> // special for JmsMessage as it can cause it to loose headers later.
> // This will be resolved when we get the message facade with copy on write
> implemented
>
> I have two questions:
> 1) How we can prevent or work around this (copy the original message into a
> custom header and do not use useOriginalMessage(). And restore the original
> message in the error flow from this custom header)?
> 2) When do you plan to fix this as the java doc suggests?
>
>
> [1]
> http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultUnitOfWork.java?view=markup
>
> Cheers,
> Christian
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Loosing-headers-by-using-errorHandler-and-useOriginalMessage-in-camel-jms-tp3046234p3046234.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus