Stream Component
The stream: component provides access to the System.in, System.out and System.err streams together with allowing streaming of output to a file.
Notice that some of the stream types has been @deprecated (file and url). These types are supported by their respective components.
URI format
stream:in stream:out stream:err stream:file?file=/foo/bar.txt (@deprecated) stream:url (@deprecated) stream:header
If the stream:header option is specified then the stream header is used to find the stream to read/write to.
Options
Name |
Default Value |
Description |
---|---|---|
file |
null |
When using the stream:file notation this specifies the file name to stream to/from. @deprecated. |
delay |
0 |
Initial delay in millis before consuming or producing the stream. |
encoding |
JVM Default |
As of Camel 1.4 the Charset encoding can be set for the text based streams. i.e. content is String object. |
Message content
The stream: component supports either String or byte[] for writing to streams. Just add to the message.in.body
either a Stirng or byte[] content.
The special stream:header URI is used for custom output streams. Just add a java.io.OutputStream
to message.in.header
in the key header
.
See samples for an example.
Samples
In this sample we output to System.out the content from the message when its put on the direct:in queue.
This sample demonstrates how the header type can be used to determine which stream to use. In the sample we use our own output stream (MyOutputStream).