Versions Compared

Key

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

...

Option

Default

Description

spoolDirectory

java.io.tmpdir

Base directory where temporary files for spooled streams should be stored. This option supports naming patterns as documented below.

spoolThreshold

128kb

Size in bytes when the stream should be spooled to disk instead of keeping in memory. Use a value of 0 or negative to disable it all together so streams is always kept in memory regardless of their size.

spoolChiper

null

If set, the temporary files are encrypted using the specified cipher transformation (i.e., a valid stream or 8-bit cipher name such as "RC4", "AES/CTR/NoPadding". An empty name "" is treated as null).

bufferSize

4096

Size in bytes of the buffer used when copying streams.

removeSpoolDirectoryWhenStopping

true

Whether to remove the spool directory when stopping CamelContext.

SpoolDirectory naming pattern

The following patterns is supported:

  • #camelId# = the CamelContext id (eg the name)
  • #name# - same as #camelId#
  • #counter# - an incrementing counter
  • #bundleId# - the OSGi bundle id (only for OSGi environments)
  • #symbolicName# - the OSGi symbolic name (only for OSGi environments)
  • #version# - the OSGi bundle version (only for OSGi environments)
  • ${env:key} - the environment variable with the key
  • ${key} - the JVM system property with the key

A could of examples, to store in the java temp directory with a sub directory using the CamelContext name:

Code Block

context.getStreamCachingStrategy().setSpoolDirectory"${java.io.tmpdir}#name#/");

To store in KARAF_HOME/tmp/bundleId directory

Code Block

context.getStreamCachingStrategy().setSpoolDirectory"${env:KARAF_HOME}/tmp/bundle#bundleId#");

Using StreamCachingStrategy in Java

...