Modified: websites/production/camel/content/stream.html
==============================================================================
--- websites/production/camel/content/stream.html (original)
+++ websites/production/camel/content/stream.html Wed Sep 23 06:19:27 2015
@@ -86,66 +86,26 @@
        <tbody>
         <tr>
         <td valign="top" width="100%">
-<div class="wiki-content maincontent"><h2 id="Stream-StreamComponent">Stream 
Component</h2>
-
-<p>The <strong>stream:</strong> component provides access to the 
<code>System.in</code>, <code>System.out</code> and <code>System.err</code> 
streams as well as allowing streaming of file and URL.</p>
-
-<p>Maven users will need to add the following dependency to their 
<code>pom.xml</code> for this component:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
-&lt;dependency&gt;
+<div class="wiki-content maincontent"><h2 id="Stream-StreamComponent">Stream 
Component</h2><p>The <strong>stream:</strong> component provides access to the 
<code>System.in</code>, <code>System.out</code> and <code>System.err</code> 
streams as well as allowing streaming of file and URL.</p><p>Maven users will 
need to add the following dependency to their <code>pom.xml</code> for this 
component:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
+<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;dependency&gt;
     &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
     &lt;artifactId&gt;camel-stream&lt;/artifactId&gt;
     &lt;version&gt;x.x.x&lt;/version&gt;
     &lt;!-- use the same version as your Camel core version --&gt;
 &lt;/dependency&gt;
 ]]></script>
-</div></div>
-
-
-<h3 id="Stream-URIformat">URI format</h3>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
-stream:in[?options]
+</div></div><h3 id="Stream-URIformat">URI format</h3><div class="code panel 
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[stream:in[?options]
 stream:out[?options]
 stream:err[?options]
 stream:header[?options]
 ]]></script>
-</div></div>
-
-<p>In addition, the <code>file</code> and <code>url</code> endpoint URIs are 
supported:</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
-stream:file?fileName=/foo/bar.txt
+</div></div><p>In addition, the <code>file</code> and <code>url</code> 
endpoint URIs are supported:</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[stream:file?fileName=/foo/bar.txt
 stream:url[?options]
 ]]></script>
-</div></div>
-
-<p>If the <code>stream:header</code> URI is specified, the <code>stream</code> 
header is used to find the stream to write to. This option is available only 
for stream producers (that is, it cannot appear in <code>from()</code>).</p>
-
-<p>You can append query options to the URI in the following format, 
<code>?option=value&amp;option=value&amp;...</code></p>
-
-<h3 id="Stream-Options">Options</h3>
-<div class="confluenceTableSmall">
-<div class="table-wrap"><table class="confluenceTable"><tbody><tr><th 
colspan="1" rowspan="1" class="confluenceTh"><p> Name </p></th><th colspan="1" 
rowspan="1" class="confluenceTh"><p> Default Value </p></th><th colspan="1" 
rowspan="1" class="confluenceTh"><p> Description </p></th></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><p> <code>delay</code> 
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>0</code> 
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> Initial delay in 
milliseconds before consuming or producing the stream. </p></td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><p> <code>encoding</code> 
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <em>JVM 
Default</em> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>  You 
can configure the encoding (is a <a shape="rect" class="external-link" 
href="http://java.sun.com/j2se/1.5.0/docs/api/java/nio/charset/Charset.html"; 
rel="nofollow">charset name</a>
 ) to use text-based streams (for example, message body is a 
<code>String</code> object). If not provided, Camel uses the <a shape="rect" 
class="external-link" 
href="http://java.sun.com/j2se/1.5.0/docs/api/java/nio/charset/Charset.html#defaultCharset()"
 rel="nofollow">JVM default Charset</a>. </p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p> <code>promptMessage</code> </p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p> <code>null</code> </p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p> Message prompt to use when 
reading from <code>stream:in</code>; for example, you could set this to 
<code>Enter a command:</code> </p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p> <code>promptDelay</code> </p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p> <code>0</code> </p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p> Optional delay in milliseconds before 
showing the message prompt. </p></td></tr><tr><td colspan="1" 
 rowspan="1" class="confluenceTd"><p> <code>initialPromptDelay</code> 
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>2000</code> 
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> Initial delay in 
milliseconds before showing the message prompt. This delay occurs only once. 
Can be used during system startup to avoid message prompts being written while 
other logging is done to the system out. </p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p> <code>fileName</code> </p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p> <code>null</code> </p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p> When using the 
<code>stream:file</code> URI format, this option specifies the filename to 
stream to/from. </p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p> <code>url</code> </p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p> <code>null</code> </p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p> W
 hen using the <code>stream:url</code> URI format, this option specifies the 
URL to stream to/from. The input/output stream will be opened using the <a 
shape="rect" class="external-link" 
href="http://docs.oracle.com/javase/6/docs/api/java/net/URLConnection.html"; 
rel="nofollow">JDK URLConnection</a> facility. </p></td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><p> <code>scanStream</code> 
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> 
<code>false</code> </p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p> To be used for continuously reading a stream such as 
the unix <code>tail</code> command. <br clear="none">
-                               <strong>Camel 2.4 to Camel 2.6:</strong> will 
retry opening the file if it is overwritten, somewhat like <code>tail 
--retry</code> </p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p> <code>retry</code> </p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p> <code>false</code> </p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.7:</strong> 
will retry opening the file if it's overwritten, somewhat like <code>tail 
--retry</code> </p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p> <code>scanStreamDelay</code> </p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p> <code>0</code> </p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p> Delay in milliseconds between read 
attempts when using <code>scanStream</code>. </p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p> <code>groupLines</code> </p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p> <code>0</
 code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> 
<strong>Camel 2.5:</strong> To group X number of lines in the consumer. For 
example to group 10 lines and therefore only spit out an <a shape="rect" 
href="exchange.html">Exchange</a> with 10 lines, instead of 1 <a shape="rect" 
href="exchange.html">Exchange</a> per line. </p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p> <code>autoCloseCount</code> </p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p> <code>0</code> </p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.10.0:</strong> 
(2.9.3 and 2.8.6) Number of messages to process before closing stream on 
Producer side. Never close stream by default (only when Producer is stopped). 
If more messages are sent, the stream is reopened for another 
<code>autoCloseCount</code> batch. </p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p> <code>closeOnDone</code> </p></td><td 
colspan="1" rowspan="1" class="c
 onfluenceTd"><p> <code>false</code> </p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p> <strong>Camel 2.11.0:</strong> This option is used in 
combination with <a shape="rect" href="splitter.html">Splitter</a> and 
streaming to the same file. The idea is to keep the stream open and only close 
when the <a shape="rect" href="splitter.html">Splitter</a> is done, to improve 
performance. Mind this requires that you only stream to the same file, and not 
2 or more files. </p></td></tr></tbody></table></div>
-</div>
-
-<h3 id="Stream-Messagecontent">Message content</h3>
-
-<p>The <strong>stream:</strong> component supports either <code>String</code> 
or <code>byte[]</code> for writing to streams. Just add either 
<code>String</code> or <code>byte[]</code> content to the 
<code>message.in.body</code>. Messages sent to the <strong>stream:</strong> 
producer in binary mode are not followed by the newline character (as opposed 
to the <code>String</code> messages). Message with <code>null</code> body will 
not be appended to the output stream.<br clear="none">
-The special <code>stream:header</code> URI is used for custom output streams. 
Just add a <code>java.io.OutputStream</code> object to 
<code>message.in.header</code> in the key <code>header</code>.<br clear="none">
-See samples for an example.</p>
-
-<h3 id="Stream-Samples">Samples</h3>
-
-<p>In the following sample we route messages from the <code>direct:in</code> 
endpoint to the <code>System.out</code> stream:</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
-// Route messages to the standard output.
+</div></div><p>If the <code>stream:header</code> URI is specified, the 
<code>stream</code> header is used to find the stream to write to. This option 
is available only for stream producers (that is, it cannot appear in 
<code>from()</code>).</p><p>You can append query options to the URI in the 
following format, <code>?option=value&amp;option=value&amp;...</code></p><h3 
id="Stream-Options">Options</h3><div class="confluenceTableSmall"><div 
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Default Value</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>delay</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>0</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Initial delay in milliseconds before 
consuming or producing the stre
 am.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>encoding</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><em>JVM Default</em></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>You can configure the encoding 
(is a <a shape="rect" class="external-link" 
href="http://java.sun.com/j2se/1.5.0/docs/api/java/nio/charset/Charset.html"; 
rel="nofollow">charset name</a>) to use text-based streams (for example, 
message body is a <code>String</code> object). If not provided, Camel uses the 
<a shape="rect" class="external-link" 
href="http://java.sun.com/j2se/1.5.0/docs/api/java/nio/charset/Charset.html#defaultCharset()"
 rel="nofollow">JVM default Charset</a>.</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>promptMessage</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>Message prompt to use when 
reading from <code>strea
 m:in</code>; for example, you could set this to <code>Enter a 
command:</code></p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>promptDelay</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>0</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Optional delay in milliseconds before 
showing the message prompt.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>initialPromptDelay</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>2000</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Initial delay in milliseconds before 
showing the message prompt. This delay occurs only once. Can be used during 
system startup to avoid message prompts being written while other logging is 
done to the system out.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>fileName</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>null</code></p
 ></td><td colspan="1" rowspan="1" class="confluenceTd"><p>When using the 
 ><code>stream:file</code> URI format, this option specifies the filename to 
 >stream to/from.</p></td></tr><tr><td colspan="1" rowspan="1" 
 >class="confluenceTd"><p><code>url</code></p></td><td colspan="1" rowspan="1" 
 >class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" 
 >class="confluenceTd"><p>When using the <code>stream:url</code> URI format, 
 >this option specifies the URL to stream to/from. The input/output stream will 
 >be opened using the <a shape="rect" class="external-link" 
 >href="http://docs.oracle.com/javase/6/docs/api/java/net/URLConnection.html"; 
 >rel="nofollow">JDK URLConnection</a> facility.</p></td></tr><tr><td 
 >colspan="1" rowspan="1" 
 >class="confluenceTd"><p><code>scanStream</code></p></td><td colspan="1" 
 >rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td 
 >colspan="1" rowspan="1" class="confluenceTd"><p>To be used for continuously 
 >reading a stream such as the unix <code
 >tail</code> command. <br clear="none"> <strong>Camel 2.4 to Camel 
 >2.6:</strong> will retry opening the file if it is overwritten, somewhat like 
 ><code>tail --retry</code></p></td></tr><tr><td colspan="1" rowspan="1" 
 >class="confluenceTd"><p><code>retry</code></p></td><td colspan="1" 
 >rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td 
 >colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.7:</strong> 
 >will retry opening the file if it's overwritten, somewhat like <code>tail 
 >--retry</code></p></td></tr><tr><td colspan="1" rowspan="1" 
 >class="confluenceTd"><p><code>scanStreamDelay</code></p></td><td colspan="1" 
 >rowspan="1" class="confluenceTd"><p><code>0</code></p></td><td colspan="1" 
 >rowspan="1" class="confluenceTd"><p>Delay in milliseconds between read 
 >attempts when using <code>scanStream</code>.</p></td></tr><tr><td colspan="1" 
 >rowspan="1" class="confluenceTd"><p><code>groupLines</code></p></td><td 
 >colspan="1" rowspan="1" class="confluenceTd"><p><code>0</code></
 p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 
2.5:</strong> To group X number of lines in the consumer. For example to group 
10 lines and therefore only spit out an <a shape="rect" 
href="exchange.html">Exchange</a> with 10 lines, instead of 1 <a shape="rect" 
href="exchange.html">Exchange</a> per line.</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>autoCloseCount</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>0</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.10.0:</strong> 
(2.9.3 and 2.8.6) Number of messages to process before closing stream on 
Producer side. Never close stream by default (only when Producer is stopped). 
If more messages are sent, the stream is reopened for another 
<code>autoCloseCount</code> batch.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>closeOnDone</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><c
 ode>false</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><strong>Camel 2.11.0:</strong> This option is used in 
combination with <a shape="rect" href="splitter.html">Splitter</a> and 
streaming to the same file. The idea is to keep the stream open and only close 
when the <a shape="rect" href="splitter.html">Splitter</a> is done, to improve 
performance. Mind this requires that you only stream to the same file, and not 
2 or more files, and that the last split message that carries the information 
that its the last, is routed to the stream endpoint so it gets the signal to 
close.</p></td></tr></tbody></table></div></div><h3 
id="Stream-Messagecontent">Message content</h3><p>The <strong>stream:</strong> 
component supports either <code>String</code> or <code>byte[]</code> for 
writing to streams. Just add either <code>String</code> or <code>byte[]</code> 
content to the <code>message.in.body</code>. Messages sent to the 
<strong>stream:</strong> producer in binary mode are n
 ot followed by the newline character (as opposed to the <code>String</code> 
messages). Message with <code>null</code> body will not be appended to the 
output stream.<br clear="none"> The special <code>stream:header</code> URI is 
used for custom output streams. Just add a <code>java.io.OutputStream</code> 
object to <code>message.in.header</code> in the key <code>header</code>.<br 
clear="none"> See samples for an example.</p><h3 
id="Stream-Samples">Samples</h3><p>In the following sample we route messages 
from the <code>direct:in</code> endpoint to the <code>System.out</code> 
stream:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[// Route messages to the standard output.
 from(&quot;direct:in&quot;).to(&quot;stream:out&quot;);
 
 // Send String payload to the standard output.
@@ -156,11 +116,7 @@ template.sendBody(&quot;direct:in&quot;,
 // No newline will be added after the message.
 template.sendBody(&quot;direct:in&quot;, &quot;Hello Bytes 
World&quot;.getBytes());
 ]]></script>
-</div></div>
-
-<p>The following sample demonstrates how the header type can be used to 
determine which stream to use. In the sample we use our own output stream, 
<code>MyOutputStream</code>.</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
+</div></div><p>The following sample demonstrates how the header type can be 
used to determine which stream to use. In the sample we use our own output 
stream, <code>MyOutputStream</code>.</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
 private OutputStream mystream = new MyOutputStream();
 private StringBuilder sb = new StringBuilder();
@@ -195,18 +151,10 @@ private class MyOutputStream extends Out
     }
 }
 ]]></script>
-</div></div>
-
-<p>The following sample demonstrates how to continuously read a file stream 
(analogous to the UNIX <code>tail</code> command):</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
-from(&quot;stream:file?fileName=/server/logs/server.log&amp;scanStream=true&amp;scanStreamDelay=1000&quot;).to(&quot;bean:logService?method=parseLogLine&quot;);
+</div></div>The following sample demonstrates how to continuously read a file 
stream (analogous to the UNIX <code>tail</code> command):<div class="code panel 
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[from(&quot;stream:file?fileName=/server/logs/server.log&amp;scanStream=true&amp;scanStreamDelay=1000&quot;).to(&quot;bean:logService?method=parseLogLine&quot;);
 ]]></script>
-</div></div>
-
-<p>One gotcha with scanStream (pre Camel 2.7) or scanStream + retry is the 
file will be re-opened and scanned with each iteration of scanStreamDelay.  
Until NIO2 is available we cannot reliably detect when a file is 
deleted/recreated.</p>
-
-<h3 id="Stream-SeeAlso">See Also</h3>
+</div></div><p>One gotcha with scanStream (pre Camel 2.7) or scanStream + 
retry is the file will be re-opened and scanned with each iteration of 
scanStreamDelay. Until NIO2 is available we cannot reliably detect when a file 
is deleted/recreated.</p><p></p><h3 id="Stream-SeeAlso">See Also</h3>
 <ul><li><a shape="rect" href="configuring-camel.html">Configuring 
Camel</a></li><li><a shape="rect" 
href="component.html">Component</a></li><li><a shape="rect" 
href="endpoint.html">Endpoint</a></li><li><a shape="rect" 
href="getting-started.html">Getting Started</a></li></ul></div>
         </td>
         <td valign="top">


Reply via email to