39.2. Stream Caching
In Apache Camel, different stream types like StreamSource, InputStream and Reader are commonly used in messaging for performance reasons and can be read only once. From Apache Camel 2.16 release, you can explicitly enable stream caching by invoking the
In Spring XML, you can set the attribute
StreamCaching() DSL method:
from("jbi:service:http://foo.bar.org/MyService")
.streamCaching()
.to("jbi:service:http://foo.bar.org/MyOtherService");
streamCache= 'true' on the route tag.
<route streamCache="true">
<from uri="jbi:service:http://foo.bar.org/MyService"/>
<to uri="jbi:service:http://foo.bar.org/MyOtherService"/>
</route>