Hi

You have to think more in terms of messaging.

A message in Camel consists of
- body
- headers

And that forms the contract of the message which represents the data
you process/route.
For example a file would map to
- body = file content
- headers = file metadata such as file name, size, modification date etc.

Other transports such as JMS will map to
- body = JMS body
- headers = JMS properties

And so forth.

So when you want to write a message as a file using a file producer
then the file name is from the header.



On Tue, May 1, 2012 at 5:52 PM, Lance Java 2 <[email protected]> wrote:
> Hi, I'm a newbie to Camel and I'm currently evaluating the product.
>
> I am reading through the
> http://camel.apache.org/tutorial-example-reportincident-part5.html
> ReportIncident tutorial  and I see the following example:
>
> from(cxfEndpoint)
>   .setHeader(FileComponent.HEADER_FILE_NAME,
> BeanLanguage.bean(FilenameGenerator.class,"generateFilename"))
>   .to("velocity:MailBody.vm")
>   .to("file://target/subfolder");
>
> The bit I am having troubles with is setting a header which I assume is then
> used by the file endpoint.
>
> I would have thought it would be better to pass some context to the file
> endpoint as follows:
>
> from(cxfEndpoint)
>   .to("velocity:MailBody.vm")
>   .to("file://target/subfolder", new FilenameGenerator());
>
> Is this practice of setting headers common in Camel? I feel it's a bit
> hacky.
>
> Thanks in advance,
> Lance.
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Passing-parameters-as-headers-feels-a-bit-hacky-tp5678320.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Email: [email protected]
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Reply via email to