camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: Cahnging endpoint from SEDA to direct causes ClassCastException
Date Thu, 17 Sep 2009 09:49:05 GMT

That is the current design when Camel was created to pass messages
using a copy mechanism.

So when you route it over SEDA it "looses" the original JmsMessage
object as its no longer bound to the JmsConsumer.
So if you need to preserve some special data then extract that
manually and set as camel headers before you route over seda.

On Thu, Sep 17, 2009 at 11:03 AM, Eric Bouer <> wrote:
> Hello.
> I recently changes some routes to use SEDA instead of direct and since then
> started to get ClassCastException on the following code in my processor.
> JmsMessage in = (JmsMessage) exchange.getIn();
> ActiveMQTextMessage activeMQTextMessage = (ActiveMQTextMessage)
> in.getJmsMessage();
> String connectionId = activeMQTextMessage.getProducerId().getConnectionId();
> exchange.getIn().setHeader("connectionId", connectionId);
> LOG:
> Error Extracting message java.lang.ClassCastException:
> org.apache.camel.impl.DefaultMessage cannot be cast to
> org.apache.camel.component.jms.JmsMessage
> I understand that SEDA causes things to be async but what can be the reason
> for the type change ?
> PS If there is a better way to get the JMS connection ID that would be
> great.
> I'm using Camel 2.0 with AMQ 5.2
> Thanks.
> --
> View this message in context:
> Sent from the Camel - Users mailing list archive at

Claus Ibsen
Apache Camel Committer

Open Source Integration:

View raw message