Author: buildbot
Date: Wed Sep 23 06:19:27 2015
New Revision: 966450
Log:
Production update by buildbot for camel
Modified:
websites/production/camel/content/book-component-appendix.html
websites/production/camel/content/book-in-one-page.html
websites/production/camel/content/cache/main.pageCache
websites/production/camel/content/stream.html
Modified: websites/production/camel/content/book-component-appendix.html
==============================================================================
--- websites/production/camel/content/book-component-appendix.html (original)
+++ websites/production/camel/content/book-component-appendix.html Wed Sep 23
06:19:27 2015
@@ -1193,11 +1193,11 @@ template.send("direct:alias-verify&
]]></script>
</div></div><p></p><h3 id="BookComponentAppendix-SeeAlso.8">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><ul><li><a
shape="rect" href="crypto.html">Crypto</a> Crypto is also available as a <a
shape="rect" href="data-format.html">Data Format</a></li></ul> <h2
id="BookComponentAppendix-CXFComponent">CXF Component</h2><div
class="confluence-information-macro confluence-information-macro-note"><span
class="aui-icon aui-icon-small aui-iconfont-warning
confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>When using CXF as a consumer, the
<a shape="rect" href="cxf-bean-component.html">CXF Bean Component</a> allows
you to factor out how message payloads are received from their processing as a
RESTful or SOAP web service. This has the potential of using a multitude of
transports to cons
ume web services. The bean component's configuration is also simpler and
provides the fastest method to implement web services using Camel and
CXF.</p></div></div><div class="confluence-information-macro
confluence-information-macro-tip"><span class="aui-icon aui-icon-small
aui-iconfont-approve confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>When using CXF in streaming modes
(see DataFormat option), then also read about <a shape="rect"
href="stream-caching.html">Stream caching</a>.</p></div></div><p>The
<strong>cxf:</strong> component provides integration with <a shape="rect"
href="http://cxf.apache.org">Apache CXF</a> for connecting to JAX-WS services
hosted in CXF.</p><p><style type="text/css">/*<![CDATA[*/
-div.rbtoc1442935130977 {padding: 0px;}
-div.rbtoc1442935130977 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1442935130977 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1442989056068 {padding: 0px;}
+div.rbtoc1442989056068 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1442989056068 li {margin-left: 0px;padding-left: 0px;}
-/*]]>*/</style></p><div class="toc-macro rbtoc1442935130977">
+/*]]>*/</style></p><div class="toc-macro rbtoc1442989056068">
<ul class="toc-indentation"><li><a shape="rect"
href="#BookComponentAppendix-CXFComponent">CXF Component</a>
<ul class="toc-indentation"><li><a shape="rect"
href="#BookComponentAppendix-URIformat">URI format</a></li><li><a shape="rect"
href="#BookComponentAppendix-Options">Options</a>
<ul class="toc-indentation"><li><a shape="rect"
href="#BookComponentAppendix-Thedescriptionsofthedataformats">The descriptions
of the dataformats</a>
@@ -4482,7 +4482,33 @@ HttpServletRequest response = exchange.g
Message out = exchange.getOut();
int responseCode = out.getHeader(Exchange.HTTP_RESPONSE_CODE,
Integer.class);
]]></script>
-</div></div><h3
id="BookComponentAppendix-UsingthrowExceptionOnFailure=falsetogetanyresponseback">Using
<code>throwExceptionOnFailure=false</code> to get any response back</h3><p>In
the route below we want to route a message that we <a shape="rect"
href="content-enricher.html">enrich</a> with data returned from a remote HTTP
call. As we want any response from the remote server, we set the
<code>throwExceptionOnFailure</code> option to <code>false</code> so we get any
response in the <code>AggregationStrategy</code>. As the code is based on a
unit test that simulates a HTTP status code 404, there is some assertion code
etc.</p><div class="error"><span class="error">Error formatting macro: snippet:
java.lang.IndexOutOfBoundsException: Index: 20, Size: 20</span> </div><h3
id="BookComponentAppendix-DisablingCookies">Disabling Cookies</h3><p>To disable
cookies you can set the HTTP Client to ignore cookies by adding this URI
option:<br clear="none"> <code>httpClient.cookiePolicy=ignoreCoo
kies</code></p><h3 id="BookComponentAppendix-AdvancedUsage">Advanced
Usage</h3><p>If you need more control over the HTTP producer you should use the
<code>HttpComponent</code> where you can set various classes to give you custom
behavior.</p><h4
id="BookComponentAppendix-SettingMaxConnectionsPerHost">Setting
MaxConnectionsPerHost</h4><p>The <a shape="rect" href="http.html">HTTP</a>
Component has a
<code>org.apache.commons.httpclient.HttpConnectionManager</code> where you can
configure various global configuration for the given component.<br
clear="none"> By global, we mean that any endpoint the component creates has
the same shared <code>HttpConnectionManager</code>. So, if we want to set a
different value for the max connection per host, we need to define it on the
HTTP component and <strong>not</strong> on the endpoint URI that we usually
use. So here comes:</p><p>First, we define the <code>http</code> component in
Spring XML. Yes, we use the same scheme name, <code>http</code>, b
ecause otherwise Camel will auto-discover and create the component with
default settings. What we need is to overrule this so we can set our options.
In the sample below we set the max connection to 5 instead of the default of
2.</p><div class="error"><span class="error">Error formatting macro: snippet:
java.lang.IndexOutOfBoundsException: Index: 20, Size: 20</span> </div>And then
we can just use it as we normally do in our routes:<div class="error"><span
class="error">Error formatting macro: snippet:
java.lang.IndexOutOfBoundsException: Index: 20, Size: 20</span> </div><h4
id="BookComponentAppendix-Usingpreemptiveauthentication">Using preemptive
authentication</h4><p>An end user reported that he had problem with
authenticating with HTTPS. The problem was eventually resolved when he
discovered the HTTPS server did not return a HTTP code 401 Authorization
Required. The solution was to set the following URI option:
<code>httpClient.authenticationPreemptive=true</code></p><h4 id="BookC
omponentAppendix-Acceptingselfsignedcertificatesfromremoteserver">Accepting
self signed certificates from remote server</h4><p>See this <a shape="rect"
class="external-link"
href="http://www.nabble.com/Using-HTTPS-in-camel-http-when-remote-side-has-self-signed-cert-td25916878.html"
rel="nofollow">link</a> from a mailing list discussion with some code to
outline how to do this with the Apache Commons HTTP API.</p><h4
id="BookComponentAppendix-SettingupSSLforHTTPClient">Setting up SSL for HTTP
Client</h4><h5
id="BookComponentAppendix-UsingtheJSSEConfigurationUtility.1">Using the JSSE
Configuration Utility</h5><p>As of Camel 2.8, the HTTP4 component supports
SSL/TLS configuration through the <a shape="rect"
href="camel-configuration-utilities.html">Camel JSSE Configuration
Utility</a>.  This utility greatly decreases the amount of component
specific code you need to write and is configurable at the endpoint and
component levels.  The following examples demonstrate how to use
the utility with the HTTP4 component.</p><p>The version of the Apache HTTP
client used in this component resolves SSL/TLS information from a global
"protocol" registry.  This component provides an implementation,
<code>org.apache.camel.component.http.SSLContextParametersSecureProtocolSocketFactory</code>,
of the HTTP client's protocol socket factory in order to support the use of
the Camel JSSE Configuration utility.  The following example demonstrates
how to configure the protocol registry and use the registered protocol
information in a route.</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
+</div></div><h3
id="BookComponentAppendix-UsingthrowExceptionOnFailure=falsetogetanyresponseback">Using
<code>throwExceptionOnFailure=false</code> to get any response back</h3><p>In
the route below we want to route a message that we <a shape="rect"
href="content-enricher.html">enrich</a> with data returned from a remote HTTP
call. As we want any response from the remote server, we set the
<code>throwExceptionOnFailure</code> option to <code>false</code> so we get any
response in the <code>AggregationStrategy</code>. As the code is based on a
unit test that simulates a HTTP status code 404, there is some assertion code
etc.</p><div class="error"><span class="error">Error formatting macro: snippet:
java.lang.IndexOutOfBoundsException: Index: 20, Size: 20</span> </div><h3
id="BookComponentAppendix-DisablingCookies">Disabling Cookies</h3><p>To disable
cookies you can set the HTTP Client to ignore cookies by adding this URI
option:<br clear="none"> <code>httpClient.cookiePolicy=ignoreCoo
kies</code></p><h3 id="BookComponentAppendix-AdvancedUsage">Advanced
Usage</h3><p>If you need more control over the HTTP producer you should use the
<code>HttpComponent</code> where you can set various classes to give you custom
behavior.</p><h4
id="BookComponentAppendix-SettingMaxConnectionsPerHost">Setting
MaxConnectionsPerHost</h4><p>The <a shape="rect" href="http.html">HTTP</a>
Component has a
<code>org.apache.commons.httpclient.HttpConnectionManager</code> where you can
configure various global configuration for the given component.<br
clear="none"> By global, we mean that any endpoint the component creates has
the same shared <code>HttpConnectionManager</code>. So, if we want to set a
different value for the max connection per host, we need to define it on the
HTTP component and <strong>not</strong> on the endpoint URI that we usually
use. So here comes:</p><p>First, we define the <code>http</code> component in
Spring XML. Yes, we use the same scheme name, <code>http</code>, b
ecause otherwise Camel will auto-discover and create the component with
default settings. What we need is to overrule this so we can set our options.
In the sample below we set the max connection to 5 instead of the default of
2.</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[
+<bean id="http"
class="org.apache.camel.component.http.HttpComponent">
+ <property name="camelContext" ref="camel"/>
+ <property name="httpConnectionManager"
ref="myHttpConnectionManager"/>
+</bean>
+
+<bean id="myHttpConnectionManager"
class="org.apache.commons.httpclient.MultiThreadedHttpConnectionManager">
+ <property name="params"
ref="myHttpConnectionManagerParams"/>
+</bean>
+
+<bean id="myHttpConnectionManagerParams"
class="org.apache.commons.httpclient.params.HttpConnectionManagerParams">
+ <property name="defaultMaxConnectionsPerHost"
value="5"/>
+</bean>
+
+]]></script>
+</div></div>And then we can just use it as we normally do in our routes:<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[
+<camelContext id="camel"
xmlns="http://camel.apache.org/schema/spring"
trace="true">
+ <route>
+ <from uri="direct:start"/>
+ <to uri="http://www.google.com"/>
+ <to uri="mock:result"/>
+ </route>
+</camelContext>
+]]></script>
+</div></div><h4 id="BookComponentAppendix-Usingpreemptiveauthentication">Using
preemptive authentication</h4><p>An end user reported that he had problem with
authenticating with HTTPS. The problem was eventually resolved when he
discovered the HTTPS server did not return a HTTP code 401 Authorization
Required. The solution was to set the following URI option:
<code>httpClient.authenticationPreemptive=true</code></p><h4
id="BookComponentAppendix-Acceptingselfsignedcertificatesfromremoteserver">Accepting
self signed certificates from remote server</h4><p>See this <a shape="rect"
class="external-link"
href="http://www.nabble.com/Using-HTTPS-in-camel-http-when-remote-side-has-self-signed-cert-td25916878.html"
rel="nofollow">link</a> from a mailing list discussion with some code to
outline how to do this with the Apache Commons HTTP API.</p><h4
id="BookComponentAppendix-SettingupSSLforHTTPClient">Setting up SSL for HTTP
Client</h4><h5 id="BookComponentAppendix-UsingtheJSSEConfigurationUt
ility.1">Using the JSSE Configuration Utility</h5><p>As of Camel 2.8, the
HTTP4 component supports SSL/TLS configuration through the <a shape="rect"
href="camel-configuration-utilities.html">Camel JSSE Configuration
Utility</a>.  This utility greatly decreases the amount of component
specific code you need to write and is configurable at the endpoint and
component levels.  The following examples demonstrate how to use the
utility with the HTTP4 component.</p><p>The version of the Apache HTTP client
used in this component resolves SSL/TLS information from a global "protocol"
registry.  This component provides an implementation,
<code>org.apache.camel.component.http.SSLContextParametersSecureProtocolSocketFactory</code>,
of the HTTP client's protocol socket factory in order to support the use of
the Camel JSSE Configuration utility.  The following example demonstrates
how to configure the protocol registry and use the registered protocol
information in a route.</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[KeyStoreParameters ksp = new
KeyStoreParameters();
ksp.setResource("/users/home/server/keystore.jks");
ksp.setPassword("keystorePassword");
@@ -10076,66 +10102,26 @@ from("direct:example").marshal
.to("mock:example").marshal(jaxb);
]]></script>
</div></div><p></p><h3 id="BookComponentAppendix-SeeAlso.60">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> <h2
id="BookComponentAppendix-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[
-<dependency>
+<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> <h2
id="BookComponentAppendix-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[<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-stream</artifactId>
<version>x.x.x</version>
<!-- use the same version as your Camel core version -->
</dependency>
]]></script>
-</div></div>
-
-
-<h3 id="BookComponentAppendix-URIformat.66">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="BookComponentAppendix-URIformat.66">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&option=value&...</code></p>
-
-<h3 id="BookComponentAppendix-Options.52">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="BookComponentAppendix-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="BookComponentAppendix-Samples.14">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&option=value&...</code></p><h3
id="BookComponentAppendix-Options.52">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
readin
g 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><c
ode>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="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, 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="BookComponentAppendix-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:</stro
ng> 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="BookComponentAppendix-Samples.14">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("direct:in").to("stream:out");
// Send String payload to the standard output.
@@ -10146,11 +10132,7 @@ template.sendBody("direct:in",
// No newline will be added after the message.
template.sendBody("direct:in", "Hello Bytes
World".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();
@@ -10185,18 +10167,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("stream:file?fileName=/server/logs/server.log&scanStream=true&scanStreamDelay=1000").to("bean:logService?method=parseLogLine");
+</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("stream:file?fileName=/server/logs/server.log&scanStream=true&scanStreamDelay=1000").to("bean:logService?method=parseLogLine");
]]></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="BookComponentAppendix-SeeAlso.61">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="BookComponentAppendix-SeeAlso.61">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> <h2
id="BookComponentAppendix-StringTemplate">String Template</h2><p>The
<strong>string-template:</strong> component allows you to process a message
using a <a shape="rect" class="external-link"
href="http://www.stringtemplate.org/" rel="nofollow">String Template</a>. This
can be ideal when using <a shape="rect" href="templating.html">Templating</a>
to generate responses for requests.</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[<dependency>
<groupId>org.apache.camel</groupId>
Modified: websites/production/camel/content/book-in-one-page.html
==============================================================================
--- websites/production/camel/content/book-in-one-page.html (original)
+++ websites/production/camel/content/book-in-one-page.html Wed Sep 23 06:19:27
2015
@@ -139,7 +139,7 @@ ConnectionFactory connectionFactory = ne
// Note we can explicit name the component
context.addComponent("test-jms",
JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));
]]></script>
-</div></div><p>The above works with any JMS provider. If we know we are using
<a shape="rect" href="activemq.html">ActiveMQ</a> we can use an even simpler
form using the <a shape="rect" class="external-link"
href="http://activemq.apache.org/maven/5.5.0/activemq-camel/apidocs/org/apache/activemq/camel/component/ActiveMQComponent.html#activeMQComponent%28java.lang.String%29"><code>activeMQComponent()</code>
method</a> while specifying the <a shape="rect" class="external-link"
href="http://activemq.apache.org/configuring-transports.html">brokerURL</a>
used to connect to ActiveMQ</p>An error occurred: Unable to retrieve the URL:
https://git-wip-us.apache.org/repos/asf?p=activemq.git;a=blob_plain;hb=HEAD;f=trunk/activemq-camel/src/test/java/org/apache/activemq/camel/component/ActiveMQRouteTest.java
status code: 404. The error has been recorded.<p>In normal use, an external
system would be firing messages or events directly into Camel through one if
its <a shape="rect" href="components.ht
ml">Components</a> but we are going to use the <a shape="rect"
class="external-link"
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/ProducerTemplate.html">ProducerTemplate</a>
which is a really easy way for testing your configuration:</p><div class="code
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>The above works with any JMS provider. If we know we are using
<a shape="rect" href="activemq.html">ActiveMQ</a> we can use an even simpler
form using the <a shape="rect" class="external-link"
href="http://activemq.apache.org/maven/5.5.0/activemq-camel/apidocs/org/apache/activemq/camel/component/ActiveMQComponent.html#activeMQComponent%28java.lang.String%29"><code>activeMQComponent()</code>
method</a> while specifying the <a shape="rect" class="external-link"
href="http://activemq.apache.org/configuring-transports.html">brokerURL</a>
used to connect to ActiveMQ</p><div class="error"><span class="error">Error
formatting macro: snippet: java.lang.IndexOutOfBoundsException: Index: 20,
Size: 20</span> </div><p>In normal use, an external system would be firing
messages or events directly into Camel through one if its <a shape="rect"
href="components.html">Components</a> but we are going to use the <a
shape="rect" class="external-link" href="http://camel.apache.org/maven/cu
rrent/camel-core/apidocs/org/apache/camel/ProducerTemplate.html">ProducerTemplate</a>
which is a really easy way for testing your configuration:</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[
ProducerTemplate template = context.createProducerTemplate();
]]></script>
@@ -3694,11 +3694,11 @@ The tutorial has been designed in two pa
While not actual tutorials you might find working through the source of the
various <a shape="rect" href="examples.html">Examples</a> useful.</li></ul>
<h2 id="BookInOnePage-TutorialonSpringRemotingwithJMS">Tutorial on Spring
Remoting with JMS</h2><p> </p><div class="confluence-information-macro
confluence-information-macro-information"><p class="title">Thanks</p><span
class="aui-icon aui-icon-small aui-iconfont-info
confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>This tutorial was kindly donated
to Apache Camel by Martin Gilday.</p></div></div><h2
id="BookInOnePage-Preface">Preface</h2><p>This tutorial aims to guide the
reader through the stages of creating a project which uses Camel to facilitate
the routing of messages from a JMS queue to a <a shape="rect"
class="external-link" href="http://www.springramework.org"
rel="nofollow">Spring</a> service. The route works in a synchronous fashion
returning a response to the client.</p><p><style type="text/css">/*<![CDATA[*/
-div.rbtoc1442949516751 {padding: 0px;}
-div.rbtoc1442949516751 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1442949516751 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1442989070422 {padding: 0px;}
+div.rbtoc1442989070422 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1442989070422 li {margin-left: 0px;padding-left: 0px;}
-/*]]>*/</style></p><div class="toc-macro rbtoc1442949516751">
+/*]]>*/</style></p><div class="toc-macro rbtoc1442989070422">
<ul class="toc-indentation"><li><a shape="rect"
href="#BookInOnePage-TutorialonSpringRemotingwithJMS">Tutorial on Spring
Remoting with JMS</a></li><li><a shape="rect"
href="#BookInOnePage-Preface">Preface</a></li><li><a shape="rect"
href="#BookInOnePage-Prerequisites">Prerequisites</a></li><li><a shape="rect"
href="#BookInOnePage-Distribution">Distribution</a></li><li><a shape="rect"
href="#BookInOnePage-About">About</a></li><li><a shape="rect"
href="#BookInOnePage-CreatetheCamelProject">Create the Camel Project</a>
<ul class="toc-indentation"><li><a shape="rect"
href="#BookInOnePage-UpdatethePOMwithDependencies">Update the POM with
Dependencies</a></li></ul>
</li><li><a shape="rect" href="#BookInOnePage-WritingtheServer">Writing the
Server</a>
@@ -5803,11 +5803,11 @@ So we completed the last piece in the pi
<p>This example has been removed from <strong>Camel 2.9</strong> onwards.
Apache Axis 1.4 is a very old and unsupported framework. We encourage users to
use <a shape="rect" href="cxf.html">CXF</a> instead of Axis.</p></div></div>
<style type="text/css">/*<![CDATA[*/
-div.rbtoc1442949517018 {padding: 0px;}
-div.rbtoc1442949517018 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1442949517018 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1442989071068 {padding: 0px;}
+div.rbtoc1442989071068 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1442989071068 li {margin-left: 0px;padding-left: 0px;}
-/*]]>*/</style><div class="toc-macro rbtoc1442949517018">
+/*]]>*/</style><div class="toc-macro rbtoc1442989071068">
<ul class="toc-indentation"><li><a shape="rect"
href="#BookInOnePage-TutorialusingAxis1.4withApacheCamel">Tutorial using Axis
1.4 with Apache Camel</a>
<ul class="toc-indentation"><li><a shape="rect"
href="#BookInOnePage-Prerequisites">Prerequisites</a></li><li><a shape="rect"
href="#BookInOnePage-Distribution">Distribution</a></li><li><a shape="rect"
href="#BookInOnePage-Introduction">Introduction</a></li><li><a shape="rect"
href="#BookInOnePage-SettinguptheprojecttorunAxis">Setting up the project to
run Axis</a>
<ul class="toc-indentation"><li><a shape="rect"
href="#BookInOnePage-Maven2">Maven 2</a></li><li><a shape="rect"
href="#BookInOnePage-wsdl">wsdl</a></li><li><a shape="rect"
href="#BookInOnePage-ConfiguringAxis">Configuring Axis</a></li><li><a
shape="rect" href="#BookInOnePage-RunningtheExample">Running the
Example</a></li></ul>
@@ -16626,7 +16626,7 @@ from("file://foo/bar").
<p>You can configure the <a shape="rect" class="external-link"
href="http://activemq.apache.org/destination-options.html">Destination
Options</a> in the endpoint uri, using the "destination." prefix. For example
to mark a consumer as exclusive, and set its prefetch size to 50, you can do as
follows:</p>
-An error occurred: Unable to retrieve the URL:
https://git-wip-us.apache.org/repos/asf?p=activemq.git;a=blob_plain;hb=HEAD;f=trunk/activemq-camel/src/test/resources/org/apache/activemq/camel/CamelDestinationExclusiveConsumerTest-context.xml
status code: 404. The error has been recorded.
+<div class="error"><span class="error">Error formatting macro: snippet:
java.lang.IndexOutOfBoundsException: Index: 20, Size: 20</span> </div>
<h3 id="BookInOnePage-ConsumingAdvisoryMessages">Consuming Advisory
Messages</h3>
@@ -16881,10 +16881,7 @@ bean:beanID[?options]
<p>The object instance that is used to consume messages must be explicitly
registered with the <a shape="rect" href="registry.html">Registry</a>. For
example, if you are using Spring you must define the bean in the Spring
configuration, <code>spring.xml</code>; or if you don't use Spring, by
registering the bean in JNDI.</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[
-]]></script>
-</div></div>
+<div class="error"><span class="error">Error formatting macro: snippet:
java.lang.IndexOutOfBoundsException: Index: 20, Size: 20</span> </div>
<p>Once an endpoint has been registered, you can build Camel routes that use
it to process exchanges.</p>
@@ -17566,11 +17563,11 @@ template.send("direct:alias-verify&
]]></script>
</div></div><p></p><h3 id="BookInOnePage-SeeAlso.28">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><ul><li><a
shape="rect" href="crypto.html">Crypto</a> Crypto is also available as a <a
shape="rect" href="data-format.html">Data Format</a></li></ul> <h2
id="BookInOnePage-CXFComponent">CXF Component</h2><div
class="confluence-information-macro confluence-information-macro-note"><span
class="aui-icon aui-icon-small aui-iconfont-warning
confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>When using CXF as a consumer, the
<a shape="rect" href="cxf-bean-component.html">CXF Bean Component</a> allows
you to factor out how message payloads are received from their processing as a
RESTful or SOAP web service. This has the potential of using a multitude of
transports to consume web
services. The bean component's configuration is also simpler and provides the
fastest method to implement web services using Camel and
CXF.</p></div></div><div class="confluence-information-macro
confluence-information-macro-tip"><span class="aui-icon aui-icon-small
aui-iconfont-approve confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>When using CXF in streaming modes
(see DataFormat option), then also read about <a shape="rect"
href="stream-caching.html">Stream caching</a>.</p></div></div><p>The
<strong>cxf:</strong> component provides integration with <a shape="rect"
href="http://cxf.apache.org">Apache CXF</a> for connecting to JAX-WS services
hosted in CXF.</p><p><style type="text/css">/*<![CDATA[*/
-div.rbtoc1442949521092 {padding: 0px;}
-div.rbtoc1442949521092 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1442949521092 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1442989079140 {padding: 0px;}
+div.rbtoc1442989079140 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1442989079140 li {margin-left: 0px;padding-left: 0px;}
-/*]]>*/</style></p><div class="toc-macro rbtoc1442949521092">
+/*]]>*/</style></p><div class="toc-macro rbtoc1442989079140">
<ul class="toc-indentation"><li><a shape="rect"
href="#BookInOnePage-CXFComponent">CXF Component</a>
<ul class="toc-indentation"><li><a shape="rect"
href="#BookInOnePage-URIformat">URI format</a></li><li><a shape="rect"
href="#BookInOnePage-Options">Options</a>
<ul class="toc-indentation"><li><a shape="rect"
href="#BookInOnePage-Thedescriptionsofthedataformats">The descriptions of the
dataformats</a>
@@ -19009,10 +19006,7 @@ Exchange.FILE_NAME = foo/bye.txt => /
</properties>
</persistence-unit>
]]></script>
-</div></div>Then we need to setup a Spring <code>jpaTemplate</code> in the
spring XML file:<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[
-]]></script>
-</div></div>And finally we can create our JPA idempotent repository in the
spring XML file as well:<div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
+</div></div>Then we need to setup a Spring <code>jpaTemplate</code> in the
spring XML file:<div class="error"><span class="error">Error formatting macro:
snippet: java.lang.IndexOutOfBoundsException: Index: 20, Size: 20</span>
</div>And finally we can create our JPA idempotent repository in the spring XML
file as well:<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[
<!-- we define our jpa based idempotent repository we want to use in the
file consumer -->
<bean id="jpaStore"
class="org.apache.camel.processor.idempotent.jpa.JpaMessageIdRepository">
@@ -20858,7 +20852,7 @@ HttpServletRequest response = exchange.g
Message out = exchange.getOut();
int responseCode = out.getHeader(Exchange.HTTP_RESPONSE_CODE,
Integer.class);
]]></script>
-</div></div><h3
id="BookInOnePage-UsingthrowExceptionOnFailure=falsetogetanyresponseback">Using
<code>throwExceptionOnFailure=false</code> to get any response back</h3><p>In
the route below we want to route a message that we <a shape="rect"
href="content-enricher.html">enrich</a> with data returned from a remote HTTP
call. As we want any response from the remote server, we set the
<code>throwExceptionOnFailure</code> option to <code>false</code> so we get any
response in the <code>AggregationStrategy</code>. As the code is based on a
unit test that simulates a HTTP status code 404, there is some assertion code
etc.An error occurred: Unable to retrieve the URL:
https://git-wip-us.apache.org/repos/asf?p=camel.git;a=blob_plain;hb=HEAD;f=components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySimplifiedHandle404Test.java
status code: 404. The error has been recorded.</p><h3
id="BookInOnePage-DisablingCookies">Disabling Cookies</h3><p>To disable cookies
you can set the
HTTP Client to ignore cookies by adding this URI option:<br clear="none">
<code>httpClient.cookiePolicy=ignoreCookies</code></p><h3
id="BookInOnePage-AdvancedUsage">Advanced Usage</h3><p>If you need more control
over the HTTP producer you should use the <code>HttpComponent</code> where you
can set various classes to give you custom behavior.</p><h4
id="BookInOnePage-SettingMaxConnectionsPerHost">Setting
MaxConnectionsPerHost</h4><p>The <a shape="rect" href="http.html">HTTP</a>
Component has a
<code>org.apache.commons.httpclient.HttpConnectionManager</code> where you can
configure various global configuration for the given component.<br
clear="none"> By global, we mean that any endpoint the component creates has
the same shared <code>HttpConnectionManager</code>. So, if we want to set a
different value for the max connection per host, we need to define it on the
HTTP component and <strong>not</strong> on the endpoint URI that we usually
use. So here comes:</p><p>First, we define the
<code>http</code> component in Spring XML. Yes, we use the same scheme name,
<code>http</code>, because otherwise Camel will auto-discover and create the
component with default settings. What we need is to overrule this so we can set
our options. In the sample below we set the max connection to 5 instead of the
default of 2.</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
+</div></div><h3
id="BookInOnePage-UsingthrowExceptionOnFailure=falsetogetanyresponseback">Using
<code>throwExceptionOnFailure=false</code> to get any response back</h3><p>In
the route below we want to route a message that we <a shape="rect"
href="content-enricher.html">enrich</a> with data returned from a remote HTTP
call. As we want any response from the remote server, we set the
<code>throwExceptionOnFailure</code> option to <code>false</code> so we get any
response in the <code>AggregationStrategy</code>. As the code is based on a
unit test that simulates a HTTP status code 404, there is some assertion code
etc.</p><div class="error"><span class="error">Error formatting macro: snippet:
java.lang.IndexOutOfBoundsException: Index: 20, Size: 20</span> </div><h3
id="BookInOnePage-DisablingCookies">Disabling Cookies</h3><p>To disable cookies
you can set the HTTP Client to ignore cookies by adding this URI option:<br
clear="none"> <code>httpClient.cookiePolicy=ignoreCookies</code></p><
h3 id="BookInOnePage-AdvancedUsage">Advanced Usage</h3><p>If you need more
control over the HTTP producer you should use the <code>HttpComponent</code>
where you can set various classes to give you custom behavior.</p><h4
id="BookInOnePage-SettingMaxConnectionsPerHost">Setting
MaxConnectionsPerHost</h4><p>The <a shape="rect" href="http.html">HTTP</a>
Component has a
<code>org.apache.commons.httpclient.HttpConnectionManager</code> where you can
configure various global configuration for the given component.<br
clear="none"> By global, we mean that any endpoint the component creates has
the same shared <code>HttpConnectionManager</code>. So, if we want to set a
different value for the max connection per host, we need to define it on the
HTTP component and <strong>not</strong> on the endpoint URI that we usually
use. So here comes:</p><p>First, we define the <code>http</code> component in
Spring XML. Yes, we use the same scheme name, <code>http</code>, because
otherwise Camel will auto
-discover and create the component with default settings. What we need is to
overrule this so we can set our options. In the sample below we set the max
connection to 5 instead of the default of 2.</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[
<bean id="http"
class="org.apache.camel.component.http.HttpComponent">
<property name="camelContext" ref="camel"/>
@@ -21668,7 +21662,7 @@ from("direct:hello")
<to uri="jetty://http://www.google.com"/>
<route>
]]></script>
-</div></div><h3 id="BookInOnePage-ConsumerExample">Consumer Example</h3><p>In
this sample we define a route that exposes a HTTP service at <code><a
shape="rect" class="external-link" href="http://localhost:8080/myapp/myservice"
rel="nofollow">http://localhost:8080/myapp/myservice</a></code>:An error
occurred: Unable to retrieve the URL:
https://git-wip-us.apache.org/repos/asf?p=camel.git;a=blob_plain;hb=HEAD;f=components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyRouteTest.java
status code: 404. The error has been recorded.</p><div
class="confluence-information-macro confluence-information-macro-note"><p
class="title">Usage of localhost</p><span class="aui-icon aui-icon-small
aui-iconfont-warning confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>When you specify
<code>localhost</code> in a URL, Camel exposes the endpoint only on the local
TCP/IP network interface, so it cannot be accessed from outside the machine it
oper
ates on.</p><p>If you need to expose a Jetty endpoint on a specific network
interface, the numerical IP address of this interface should be used as the
host. If you need to expose a Jetty endpoint on all network interfaces, the
<code>0.0.0.0</code> address should be used.</p></div></div><div
class="confluence-information-macro confluence-information-macro-tip"><span
class="aui-icon aui-icon-small aui-iconfont-approve
confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>To listen across an entire URI
prefix, see <a shape="rect" href="how-do-i-let-jetty-match-wildcards.html">How
do I let Jetty match wildcards</a>.</p></div></div><div
class="confluence-information-macro confluence-information-macro-tip"><span
class="aui-icon aui-icon-small aui-iconfont-approve
confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>If you actually want to expose
routes by HTTP and already have a Servlet, you should instead refer
to the <a shape="rect"
href="https://cwiki.apache.org/confluence/display/CXF20DOC/Servlet+Transport">Servlet
Transport</a>.</p></div></div><p> </p><p>Our business logic is
implemented in the <code>MyBookService</code> class, which accesses the HTTP
request contents and then returns a response.<br clear="none">
<strong>Note:</strong> The <code>assert</code> call appears in this example,
because the code is part of an unit test.An error occurred: Unable to retrieve
the URL:
https://git-wip-us.apache.org/repos/asf?p=camel.git;a=blob_plain;hb=HEAD;f=components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyRouteTest.java
status code: 404. The error has been recorded.The following sample shows a
content-based route that routes all requests containing the URI parameter,
<code>one</code>, to the endpoint, <code>mock:one</code>, and all others to
<code>mock:other</code>.</p><div class="error"><span class="error">Error
formatting macro: snippet: java.lang.IndexOutOfBou
ndsException: Index: 20, Size: 20</span> </div>So if a client sends the HTTP
request, <code><a shape="rect" class="external-link"
href="http://serverUri?one=hello"
rel="nofollow">http://serverUri?one=hello</a></code>, the Jetty component will
copy the HTTP request parameter, <code>one</code> to the exchange's
<code>in.header</code>. We can then use the <code>simple</code> language to
route exchanges that contain this header to a specific endpoint and all others
to another. If we used a language more powerful than <a shape="rect"
href="simple.html">Simple</a> (such as <a shape="rect"
href="el.html">EL</a> or <a shape="rect" href="ognl.html">OGNL</a>) we
could also test for the parameter value and do routing based on the header
value as well.<h3 id="BookInOnePage-SessionSupport">Session Support</h3><p>The
session support option, <code>sessionSupport</code>, can be used to enable a
<code>HttpSession</code> object and access the session object while processing
the exchange. Fo
r example, the following route enables sessions:</p><div class="code panel
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><h3 id="BookInOnePage-ConsumerExample">Consumer Example</h3><p>In
this sample we define a route that exposes a HTTP service at <code><a
shape="rect" class="external-link" href="http://localhost:8080/myapp/myservice"
rel="nofollow">http://localhost:8080/myapp/myservice</a></code>:</p><div
class="error"><span class="error">Error formatting macro: snippet:
java.lang.IndexOutOfBoundsException: Index: 20, Size: 20</span> </div><div
class="confluence-information-macro confluence-information-macro-note"><p
class="title">Usage of localhost</p><span class="aui-icon aui-icon-small
aui-iconfont-warning confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>When you specify
<code>localhost</code> in a URL, Camel exposes the endpoint only on the local
TCP/IP network interface, so it cannot be accessed from outside the machine it
operates on.</p><p>If you need to expose a Jetty endpoint on a specific network
interface, the numerical IP address of t
his interface should be used as the host. If you need to expose a Jetty
endpoint on all network interfaces, the <code>0.0.0.0</code> address should be
used.</p></div></div><div class="confluence-information-macro
confluence-information-macro-tip"><span class="aui-icon aui-icon-small
aui-iconfont-approve confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>To listen across an entire URI
prefix, see <a shape="rect" href="how-do-i-let-jetty-match-wildcards.html">How
do I let Jetty match wildcards</a>.</p></div></div><div
class="confluence-information-macro confluence-information-macro-tip"><span
class="aui-icon aui-icon-small aui-iconfont-approve
confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>If you actually want to expose
routes by HTTP and already have a Servlet, you should instead refer to the <a
shape="rect"
href="https://cwiki.apache.org/confluence/display/CXF20DOC/Servlet+Transport">Servlet
Transp
ort</a>.</p></div></div><p> </p><p>Our business logic is implemented in
the <code>MyBookService</code> class, which accesses the HTTP request contents
and then returns a response.<br clear="none"> <strong>Note:</strong> The
<code>assert</code> call appears in this example, because the code is part of
an unit test.</p><div class="error"><span class="error">Error formatting macro:
snippet: java.lang.IndexOutOfBoundsException: Index: 20, Size: 20</span>
</div>The following sample shows a content-based route that routes all requests
containing the URI parameter, <code>one</code>, to the endpoint,
<code>mock:one</code>, and all others to <code>mock:other</code>.<div
class="error"><span class="error">Error formatting macro: snippet:
java.lang.IndexOutOfBoundsException: Index: 20, Size: 20</span> </div>So if a
client sends the HTTP request, <code><a shape="rect" class="external-link"
href="http://serverUri?one=hello"
rel="nofollow">http://serverUri?one=hello</a></code>, the Jetty comp
onent will copy the HTTP request parameter, <code>one</code> to the exchange's
<code>in.header</code>. We can then use the <code>simple</code> language to
route exchanges that contain this header to a specific endpoint and all others
to another. If we used a language more powerful than <a shape="rect"
href="simple.html">Simple</a> (such as <a shape="rect"
href="el.html">EL</a> or <a shape="rect" href="ognl.html">OGNL</a>) we
could also test for the parameter value and do routing based on the header
value as well.<h3 id="BookInOnePage-SessionSupport">Session Support</h3><p>The
session support option, <code>sessionSupport</code>, can be used to enable a
<code>HttpSession</code> object and access the session object while processing
the exchange. For example, the following route enables sessions:</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[<route>
<from
uri="jetty:http://0.0.0.0/myapp/myservice/?sessionSupport=true"/>
<processRef ref="myCode"/>
@@ -26478,66 +26472,26 @@ from("direct:example").marshal
.to("mock:example").marshal(jaxb);
]]></script>
</div></div><p></p><h3 id="BookInOnePage-SeeAlso.80">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> <h2
id="BookInOnePage-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[
-<dependency>
+<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> <h2
id="BookInOnePage-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[<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-stream</artifactId>
<version>x.x.x</version>
<!-- use the same version as your Camel core version -->
</dependency>
]]></script>
-</div></div>
-
-
-<h3 id="BookInOnePage-URIformat.67">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="BookInOnePage-URIformat.67">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&option=value&...</code></p>
-
-<h3 id="BookInOnePage-Options.73">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="BookInOnePage-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="BookInOnePage-Samples.21">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&option=value&...</code></p><h3
id="BookInOnePage-Options.73">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 producin
g 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>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="confluenc
eTd"><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, 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="BookInOnePage-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="BookInOnePage-Samples.21">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("direct:in").to("stream:out");
// Send String payload to the standard output.
@@ -26548,11 +26502,7 @@ template.sendBody("direct:in",
// No newline will be added after the message.
template.sendBody("direct:in", "Hello Bytes
World".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();
@@ -26587,18 +26537,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("stream:file?fileName=/server/logs/server.log&scanStream=true&scanStreamDelay=1000").to("bean:logService?method=parseLogLine");
+</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("stream:file?fileName=/server/logs/server.log&scanStream=true&scanStreamDelay=1000").to("bean:logService?method=parseLogLine");
]]></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="BookInOnePage-SeeAlso.81">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="BookInOnePage-SeeAlso.81">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> <h2
id="BookInOnePage-StringTemplate">String Template</h2><p>The
<strong>string-template:</strong> component allows you to process a message
using a <a shape="rect" class="external-link"
href="http://www.stringtemplate.org/" rel="nofollow">String Template</a>. This
can be ideal when using <a shape="rect" href="templating.html">Templating</a>
to generate responses for requests.</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[<dependency>
<groupId>org.apache.camel</groupId>
Modified: websites/production/camel/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.