camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen" <>
Subject Re: not getting exception from exchange
Date Wed, 10 Dec 2008 20:36:29 GMT

Yeah the JMS doesn't allow Objects being sent as JMS properties. Only
primitive types such as numbers and Strings.
So the exception should be store on the exchange body.

If you use you own wrapper object to store both the real body and the
exception then Camel will use a javax.jms.ObjectMessage to send it and
you should then keep the exception. On the other side you can get the
stuff out from your own wrapper.

Check this nabble with a similar issue:

On Wed, Dec 10, 2008 at 7:20 PM, ychawla <> wrote:
> Sorry,
> Let me clarify.  The technique below works fine if you go directly to a
> bean, but if there is a queue in the middle then you lose the exception.
> The test I ran was incorrect.
> -Yogesh
> ychawla wrote:
>> Hi Claus,
>> Thanks for the response.  Since I have camel on both ends of the queue
>> here, it is easy enough to set a message property to handle it:
>> Throw an exception like this:
>> Exception exception = new Exception("No Client ID was found.");
>> exchange.getIn().setHeader("SSAFException", exception);
>> throw exception;
>> Have a bean in a pipeline for my error queue and get the Exception:
>> Exception ssafException = (Exception) message.getHeader("SSAFException");
>> I see some of the design challenges of preserving exceptions over JMS
>> especially when you don't want consumer is on the other end.  For my issue
>> it is camel to camel in the same JVM so this works great.
>> I am going to review the JIRA's and throw in a vote.
>> Cheers,
>> Yogesh
> --
> View this message in context:
> Sent from the Camel - Users mailing list archive at


/Claus Ibsen
Apache Camel Committer

View raw message