THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
You set these properties on the CamelContext as shown below, where we use a 1mb threshold to spool to disk for messages bigger than 1mb:
Code Block | ||||
---|---|---|---|---|
| ||||
context.getProperties().put(CachedOutputStream.TEMP_DIR, "/tmp/cachedir"); context.getProperties().put(CachedOutputStream.THRESHOLD, "10241048576"); context.getProperties().put(CachedOutputStream.BUFFER_SIZE, "4096131072"); // to enable encryption using RC4 // context.getProperties().put(CachedOutputStream.CIPHER_TRANSFORMATION, "RC4"); |
And in XML you do
Code Block | ||||
---|---|---|---|---|
| ||||
<camelContext xmlns="http://camel.apache.org/schema/blueprint">
<!-- disable stream caching spool to disk -->
<properties>
<property key="CamelCachedOutputStreamOutputDirectory" value="/tmp/cachedir"/>
<property key="CamelCachedOutputStreamThreshold" value="1048576"/>
<property key="CamelCachedOutputStreamBufferSize" value="131072"/>
</properties>
|
Disabling spooling to disk
...
Code Block |
---|
// disable spooling to disk context.getProperties().put(CachedOutputStream.THRESHOLD, "0-1"); |
And in XML you do
Code Block | ||||
---|---|---|---|---|
| ||||
<camelContext xmlns="http://camel.apache.org/schema/blueprint">
<!-- disable stream caching spool to disk -->
<properties>
<property key="CamelCachedOutputStreamThreshold" value="-1"/>
</properties>
|
How it works?
In order to determine if a type requires caching, we leverage the type converter feature. Any type that requires stream caching can be converted into an org.apache.camel.StreamCache
instance.