Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

StreamCache supports the global and per route scope. So by setting the streamCache attribute on camelContext you can enable/disable it globally.

Code Block
xml
xml
<camelContext streamCache="true">
   ...
</camelContext>

The

...

route

...

scope

...

is

...

configured

...

by

...

the

...

streamCache

...

attribute

...

on

...

the

...

<route>

...

tag

...

such

...

as:

Code Block
xml
xml

{code:xml}
<route streamCaching="true">
   <from uri="jbi:service:http://foo.bar.org/MyService"/>
   <to uri="jbi:service:http://foo.bar.org/MyOtherService"/>
</route>

You can mix and match for instance you can enable it globally and disable it on a particular route such as:

Code Block
xml
xml
<camelContext streamCache="true">
  <route>
    <from uri="jbi:service:http://foo.bar.org/MyService"/>
    <to uri="jbi:service:http://foo.bar.org/MyOtherService"/>
  </route>
  
  <route streamCache="false">
    <from uri="jms:queue:foo"/>
    <to uri="jms:queue:bar"/>
  </route>

</camelContext>

...

You set these properties on the CamelContext as shown below:

Code Block
java
java
    context.getProperties().put(CachedOutputStream.TEMP_DIR, "/tmp/cachedir");
    context.getProperties().put(CachedOutputStream.THRESHOLD, "1024");

...

Available as of *Camel 1.6.2/2.0
You can disable spooling to disk by setting a threshold of 0 or a negative value.

Code Block
    // disable spooling to disk
    context.getProperties().put(CachedOutputStream.THRESHOLD, "0");

...