Reputation: 3349
Is it possible to set a message header to a value read from a properties file, using the camel Properties Component? I can set such properties to URI options, but I'm unable to set them as a header values.
I need something like this:
<camel:setHeader headerName="actionId">
<camel:constant>{{onus.transPosting.RtSFailed}}</camel:constant>
</camel:setHeader>
where onus.transPosting.RtSFailed
is a property key set on a file imported using camel Properties Component.
Note: I'm using Apache Camel 2.10.1
UPDATE
Using the <propertyPlaceholder>
as suggested by this discussion did not work and it causes an exception:
Caused by: org.apache.camel.language.simple.types.SimpleParserException: Unknown function: onus.transPosting.RtSFailed
Upvotes: 5
Views: 12071
Reputation: 55550
Yes you can, use the simple language which has a properties function: http://camel.apache.org/simple
<camel:setHeader headerName="actionId">
<camel:simple>${properties:onus.transPosting.RtSFailed}</camel:simple>
</camel:setHeader>
Though I think we have fixed in latest Camel releases that < camel:constant > will resolve property placeholders as well.
Upvotes: 7