On 18/03/2008, cmoulliard <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I would like to know if this is possible to enrich the message(s) (by adding
> a property or a header) created during a transformation step.
>
> ex :
> from("file:///c:/temp/test?noop=true")
> .unmarshal().csv()
> .to("test-jms:queue:test.queue");
>
> According to this DSL route, the files created in the dir c:/temp/test will
> be read, parsed and transformed using a CsvDataFormat. Next, the result of
> this tranformation will be placed into a queue (test.queue).
>
> My question is the following ?
>
> Is it possible to add a property/header to the messages posted in a queue ?
>
> from("file:///c:/temp/test?noop=true")
> .unmarshal().csv()
> .setProperty("Client", "Jack")
> .to("test-jms:queue:test.queue");
>
> The idea is that in the next route, I can check the property/header name and
> depending on the value I can process differently the messages.
Absolutely!
We have properties on an Exchange which are intended to be transient
things during the processing, then headers on a Message which are
typically intended to travel over the wire (some endpoints might
filter out or transform some headers).
So if you use
from("file:///c:/temp/test?noop=true")
.unmarshal().csv()
.setHeader("Client", "Jack")
.to("test-jms:queue:test.queue");
it will populate the JMS header "Client"
I guess part of the confusion is the JMS API refers to them as
'properties' :) We've kinda used HTTP/email style terminology for
headers & properties which might cause confusion.
--
James
-------
http://macstrac.blogspot.com/
Open Source Integration
http://open.iona.com