If you look at the java DSL of camel, you will find the "to()" can take
the endpoint or uri as a parameter.
It provides a generic way for user to specify the endpoint that he want
to send the message to.
We use the message header to override the configuration from uri or
endpoint, your suggestion just
breaks the generic way.
On Tue May 1 23:52:33 2012, Lance Java 2 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.
--
Willem
----------------------------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Web: http://www.fusesource.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang