camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Pass properties/headers to another endpoint
Date Fri, 05 Mar 2010 08:19:57 GMT
On Fri, Mar 5, 2010 at 9:14 AM, Johan Haleby <johan.haleby@gmail.com> wrote:
>
> Hi,
>
> Is it possible to propagate headers or properties (what's the difference?)
> between two endpoints? I have state stored in threadlocal and I need to copy
> this state on thread switches. What I want is something like:
>
> from("direct:copy_state").setHeader("state",
> getStateFromThreadLocal()).to("my_seda_endoint");
> from("my_seda_endoint").process(getStateFromHeaderAndPutItBackInThreadLocal()).process(doSomething())...
>

Yes that is possible. Headers are stored on the Message in a Map
structure. So headers "follow" you message body.

Headers are more protocol specific and can be also used to
control/override options on endpoints.
Many components supports headers, eg JMS headers is JMS properties
(yeah they are called properties in JMS).
For HTTP headers is the HTTP headers etc.

Properties are kinda like metadata about the exchange used internally
by camel. Its avail for the entire lifecycle of the Exchange.
Properties is also a Map structure.

So you can store it in either one, your choice :)
But I think you should use a header as it appears to be very message specific.



> /Johan
> --
> View this message in context: http://old.nabble.com/Pass-properties-headers-to-another-endpoint-tp27790977p27790977.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

Mime
View raw message