views:

49

answers:

2

We use Message or Exchange to set the outbound message . the only method these provide is

exchange.getOut.setBody();

if i do something like setBody(new Object())..it doesn't work

so how do we send java objects via camel exchange.

A: 

And setting a payload as new Object() just means you send an empty object. And if you want serialized objects, then you object must be serializable such as implementing java.io.Serializable

And where do you route the message afterwards?

Claus Ibsen
A: 

I am really glad Claus Isben has replied(attended the "Intro to camel webinar"). sorry for the newbie question...i sent the serialized object as e.getOut().setBody(new Object()); and got it working fine via typecasting in the recieving bean as (Object) e2.getIn().getBody();.my camelcontext was this ...which worked fine outputting messages at fixed intervals.But all hell broke loose when i changed my camelcontext to this ..it was spamming lot of message's.So,what exactly Does above route do ? And can u please answer below few questions.. 1) in the bean "send" for the URI ...how do u send outbound message's without using Exchange as a parameter in the send() method..is their anyway to do this(any annotation?).I am using Spring Xml to route. 2)What exactly does the Log component do ? Does it only log virtually.is there no physical side to it ?

Many thanks

sanre6
Intial route was:<from uri="timer:MusigmaTimer?fixedRate=true" /> <to uri="bean:send?method=send" /> <to uri="bean:recv?method=recv" /> later route was :<from uri="bean:send?method=send" /> <to uri="bean:recv?method=recv" /> ..really sorry for not posting it initially
sanre6
I think we have this covered in one of your other questions about Camel, how to exchange messages between 2 beans.
Claus Ibsen