Hi,
I'm using Camel 2.7.2, and I have a Spring XML file with multiple Camel
Contexts defined. To expose the properties defined in an external file to
the camel contexts, we have the following lines in the XML:
<bean id="properties"
class="org.apache.camel.component.properties.PropertiesComponent">
<property name="location" value="file:///location/to/file.properties" />
</bean>
We can then use the syntax {{my.property}} in multiple camelContext
definitions in the same file, for example in from:
<camel:from
uri="activemq:name.of.queue?selector=myHeaderProperty='{{my.property}}'" />
However when using Simple, the use of {{ }} for properties does not work, we
must use ${properties:my.property}:
<camel:simple>${properties:my.property} == 'true'</camel:simple>
We must also add the following line to load the properties again for this
camelContext:
<camel:propertyPlaceholder id="properties2"
location="file:///location/to/file.properties"/>
Otherwise it does not work as it doesn't seem to use the bean "properties"
defined elsewhere outside of the camelContext.
My question is, is there a better way of doing this? At the moment, I have
to add a reference to my properties file three times: once for Spring, once
for Camel and once again in the camelContext using camel:simple.
Thanks for any tips!
--
View this message in context:
http://camel.465427.n5.nabble.com/Multiple-camelContext-in-Spring-XML-with-single-properties-reference-tp4912793p4912793.html
Sent from the Camel - Users mailing list archive at Nabble.com.