Thursday, March 12, 2009

Set the properties for Camel Context

If you want to do customer configuration on the inner component of Camel 2.0, how can you achieve that? You may say to use the system properties is a easy way.
But if I want to configure the component per camel context, as you know there could be more than one camel context per JVM.
I just introduced a property configuration per camel context in the Camel 2.0, so you want to configure the cachedOutputStream of Camel , you can do it like this.

With the java code

Map<String, String> properties = new HashMap<String, String>();
properties.put(CachedOutputStream.THRESHOLD, "1000");
properties.put(CachedOutputStream.TEMP_DIR, "/tmp/camel");

With Spring configuration

<camelContext id="camel" xmlns="">
<property key="CamelCachedOutputStreamThreshold" value="10000"/>
<property key="CamelCachedOutputStreamOutputDirectory" value="/tmp/camel"/>
<property key="the key of properties" value="the value as string"/>