camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roman Kalukiewicz" <roman.kalukiew...@gmail.com>
Subject Re: XPath splitter again
Date Fri, 28 Dec 2007 13:26:50 GMT
2007/12/28, Robert Thullner <rthullner@gmx.at>:
> Hi
>
> XPathBuilder xPathBuilder=new XPathBuilder("//trainSchedule/stops/station");
> from("activemq:queue:camel.train.plan.queue")
> .splitter(xPathBuilder)
> .to("activemq:queue:camel.train.plan.queue.receiver");
>
> When I now start the consumer, receiver and camelContext, my receiver does
> not receive a TextMessage, anymore but an ObjectMessage. The object in the
> message is an object of the class
> com.sun.org.apache.xerces.internal.dom.DeferredElementNSImpl.
>
> What happened here to my TextMessage? Can it be a problem with my xpath or
> do I need some additional statements so that the receiver get a TextMessage
> again? I think my xpath expression is correct, as the receiver receives the
> correct amount of messages it should receive.

What you have in your message is XML Object - not a String - so
ObjectMessage is sent.

Try to do it this way:

from("activemq:queue:camel.train.plan.queue")
.splitter(xPathBuilder)
.convertBodyTo(String.class)
.to("activemq:queue:camel.train.plan.queue.receiver");

Then activemq endpoint will receive String as a payload and should
create TextMessage instead of ObjectMessage.

Roman

Mime
View raw message