Apache Camel often transports message bodies as streams, for example InputStream, Reader, or StreamSource. These types are efficient because they avoid loading the whole payload into memory immediately. The danger is that a stream is normally consumable only once. After one processor, logger, validator, or component reads it, the next step in the route may see an empty body.
Camel stream caching solves this by converting the stream into a re-readable cache. This allows the same message body to be read multiple times, which is important for logging, retries, content-based routing, validation, error handling, or any route where more than one processor needs access to the payload.
(more…)




