-
1. Re: How to get the System Environment variable inside camel context
bharadwaj Feb 26, 2015 5:00 AM (in response to niteshjain132)1 of 1 people found this helpfulUsing system and environment variables in locations
Available as of Camel 2.7
The location now supports using placeholders for JVM system properties and
OS environments variables.
For example:
location=file:${karaf.home}/etc/foo.properties
In the location above we defined a location using the file scheme using the
JVM system property with key karaf.home.
To use an OS environment variable instead you would have to prefix with env:
location=file:$/etc/foo.properties
Where APP_HOME is an OS environment.
You can have multiple placeholders in the same location, such as:
location=file:$/etc/${prop.name}.properties
Using out of the box functions
Available as of Camel 2.14.1
The Properties
-
2. Re: How to get the System Environment variable inside camel context
niteshjain132 Feb 26, 2015 5:40 AM (in response to bharadwaj)Thanks Bhardwaj, That helped me , below is my camel context.
<camelContext trace="false" id="Camel" xmlns="http://camel.apache.org/schema/spring">
.....
.....
<route id="loadtoMemory">
<from uri="cxf:bean:demo-ws" />
<log message="Hi this is{{myName}}"/>
</route>
</camelContext>
<bean id="properties" class="org.apache.camel.component.properties.PropertiesComponent">
<property name="location" value="file:${env:JBOSS_FUSE_HOME}/conf/test.properties" />
</bean>
2015-02-26 16:01:37,387 | INFO l loadtoMemory ? | 158 - org.apache.camel.camel-core - 2.12.0.redhat-610379 | Hi this is xyz
Regards,
Nitesh