Author: buildbot
Date: Fri Aug 25 18:20:06 2017
New Revision: 1017291
Log:
Production update by buildbot for camel
Modified:
websites/production/camel/content/book-in-one-page.html
websites/production/camel/content/cache/main.pageCache
websites/production/camel/content/mina.html
websites/production/camel/content/mybatis.html
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 Fri Aug 25 18:20:06
2017
@@ -4368,11 +4368,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.rbtoc1503674329144 {padding: 0px;}
-div.rbtoc1503674329144 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1503674329144 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1503685127073 {padding: 0px;}
+div.rbtoc1503685127073 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1503685127073 li {margin-left: 0px;padding-left: 0px;}
-/*]]>*/</style><div class="toc-macro rbtoc1503674329144">
+/*]]>*/</style><div class="toc-macro rbtoc1503685127073">
<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>
Modified: websites/production/camel/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.
Modified: websites/production/camel/content/mina.html
==============================================================================
--- websites/production/camel/content/mina.html (original)
+++ websites/production/camel/content/mina.html Fri Aug 25 18:20:06 2017
@@ -36,17 +36,6 @@
<![endif]-->
- <link href='//camel.apache.org/styles/highlighter/styles/shCoreCamel.css'
rel='stylesheet' type='text/css' />
- <link href='//camel.apache.org/styles/highlighter/styles/shThemeCamel.css'
rel='stylesheet' type='text/css' />
- <script src='//camel.apache.org/styles/highlighter/scripts/shCore.js'
type='text/javascript'></script>
- <script src='//camel.apache.org/styles/highlighter/scripts/shBrushJava.js'
type='text/javascript'></script>
- <script src='//camel.apache.org/styles/highlighter/scripts/shBrushXml.js'
type='text/javascript'></script>
- <script src='//camel.apache.org/styles/highlighter/scripts/shBrushPlain.js'
type='text/javascript'></script>
-
- <script type="text/javascript">
- SyntaxHighlighter.defaults['toolbar'] = false;
- SyntaxHighlighter.all();
- </script>
<title>
Apache Camel: MINA
@@ -86,107 +75,31 @@
<tbody>
<tr>
<td valign="top" width="100%">
-<div class="wiki-content maincontent"><h2 id="MINA-MINAComponent">MINA
Component</h2><p><strong>Deprecated</strong></p><div
class="confluence-information-macro confluence-information-macro-warning"><p
class="title">Deprecated</p><span class="aui-icon aui-icon-small
aui-iconfont-error confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>This component is deprecated as
the Apache Mina 1.x project is EOL. Instead use <a shape="rect"
href="mina2.html">MINA2</a> or <a shape="rect" href="netty.html">Netty</a>
instead.</p></div></div><p>The <strong>mina:</strong> component is a transport
for working with <a shape="rect" class="external-link"
href="http://mina.apache.org/">Apache MINA</a></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>
+<div class="wiki-content maincontent"><h2 id="MINA-MINAComponent">MINA
Component</h2><p><strong>Deprecated</strong></p><parameter
ac:name="title">Deprecated</parameter><rich-text-body><p>This component is
deprecated as the Apache Mina 1.x project is EOL. Instead use <a shape="rect"
href="mina2.html">MINA2</a> or <a shape="rect" href="netty.html">Netty</a>
instead.</p></rich-text-body><p>The <strong>mina:</strong> component is a
transport for working with <a shape="rect" class="external-link"
href="http://mina.apache.org/">Apache MINA</a></p><p>Maven users will need to
add the following dependency to their <code>pom.xml</code> for this
component:</p><parameter
ac:name="">xml</parameter><plain-text-body><dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-mina</artifactId>
<version>x.x.x</version>
<!-- use the same version as your Camel core version -->
</dependency>
-]]></script>
-</div></div><h3 id="MINA-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[mina:tcp://hostname[:port][?options]
+</plain-text-body><h3 id="MINA-URIformat">URI
format</h3><plain-text-body>mina:tcp://hostname[:port][?options]
mina:udp://hostname[:port][?options]
mina:vm://hostname[:port][?options]
-]]></script>
-</div></div><p>You can specify a codec in the <a shape="rect"
href="registry.html">Registry</a> using the <strong>codec</strong> option. If
you are using TCP and no codec is specified then the <code>textline</code> flag
is used to determine if text line based codec or object serialization should be
used instead. By default the object serialization is used.</p><p>For UDP if no
codec is specified the default uses a basic <code>ByteBuffer</code> based
codec.</p><p>The VM protocol is used as a direct forwarding mechanism in the
same JVM. See the <a shape="rect" class="external-link"
href="http://mina.apache.org/report/1.1/apidocs/org/apache/mina/transport/vmpipe/package-summary.html">MINA
VM-Pipe API documentation</a> for details.</p><p>A Mina producer has a default
timeout value of 30 seconds, while it waits for a response from the remote
server.</p><p>In normal use, <code>camel-mina</code> only supports marshalling
the body content—message headers and exchange properties are not
sent.<br clear="none"> However, the option,
<strong>transferExchange</strong>, does allow you to transfer the exchange
itself over the wire. See options below.</p><p>You can append query options to
the URI in the following format,
<code>?option=value&option=value&...</code></p><h3
id="MINA-Options">Options</h3><div class="confluenceTableSmall"><div
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1"
rowspan="1" class="confluenceTh"><p>Option</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>codec</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>You can refer to a named
<code>ProtocolCodecFactory</code> instance in your <a shape="rect"
href="registry.html">Registry</a> such as your Spring
<code>ApplicationContext</code>, which is then used for the
marshalling.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>codec</code></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>You must use the <code>#</code> notation to look up
your codec in the <a shape="rect" href="registry.html">Registry</a>. For
example, use <code>#myCodec</code> to look up a bean with the <code>id</code>
value, <code>myCodec</code>.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>disconnect</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.3:</strong> Whether or not
to disconnect(close) from Mina session right after use. Can be used for both
consumer and producer.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>textline</code>
</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Only used for TCP. If no codec is specified, you can
use this flag to indicate a text line based codec; if not specified or the
value is <code>false</code>, then Object Serialization is assumed over
TCP.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>textlineDelimiter</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>DEFAULT</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Only used for TCP and if
<strong>textline=true</strong>. Sets the text line delimiter to use. Possible
values are: <code>DEFAULT</code>, <code>AUTO</code>, <code>WINDOWS</code>,
<code>UNIX</code> or <code>MAC</code>. If none provided, Camel will use
<code>DEFAULT</code>. This delimiter is used to mark the end of
text.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>sync</code></p></
td><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>true</code></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Setting to set endpoint as one-way or
request-response.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>lazySessionCreation</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Sessions can be lazily created
to avoid exceptions, if the remote server is not up and running when the Camel
producer is started.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>timeout</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>30000</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>You can configure the timeout that
specifies how long to wait for a response from a remote server. The timeout
unit is in milliseconds, so 60000 is 60 seconds. The timeout is only used for
Mina producer.</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
(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 for the TCP textline codec and the UDP
protocol. If not provided, Camel will use 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>transferExchange</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Only used for TCP. You can
transfer the exchange over the wire instead of just the bo
dy. The following fields are transferred: In body, Out body, fault body, In
headers, Out headers, fault headers, exchange properties, exchange exception.
This requires that the objects are <em>serializable</em>. Camel will exclude
any non-serializable objects and log it at <code>WARN</code>
level.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>minaLogger</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>You can enable the Apache MINA logging
filter. Apache MINA uses <code>slf4j</code> logging at <code>INFO</code> level
to log all input and output.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>filters</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>You can set a list of <a shape="rect"
class="external-link" href="http://mina.apache.org/io
filter.html">Mina IoFilters</a> to register. The <code>filters</code> value
must be one of the following:</p><ul><li><strong>Camel 2.2:</strong>
comma-separated list of bean references (e.g.
<code>#filterBean1,#filterBean2</code>) where each bean must be of type
<code>org.apache.mina.common.IoFilter</code>.</li><li><strong>before Camel
2.2:</strong> a reference to a bean of type
<code>List<org.apache.mina.common.IoFilter></code>.</li></ul></td></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p><code>encoderMaxLineLength</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>-1</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>As of 2.1, you can set the
textline protocol encoder max line length. By default the default value of Mina
itself is used which are <code>Integer.MAX_VALUE</code>.</p></td></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p><code>decoderMaxLineLength</code></p></td><td
colspan="1" rowspan="1" class="co
nfluenceTd"><p><code>-1</code></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>As of 2.1, you can set the textline protocol decoder
max line length. By default the default value of Mina itself is used which are
1024.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>producerPoolSize</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>16</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>The TCP producer is thread safe and supports
concurrency much better. This option allows you to configure the number of
threads in its thread pool for concurrent producers. <strong>Note:</strong>
Camel has a pooled service which ensured it was already thread safe and
supported concurrency already.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>allowDefaultCodec</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>The mina
component installs a default codec if both, <code>codec</code> is
<code>null</code> and <code>textline</code> is <code>false</code>. Setting
<code>allowDefaultCodec</code> to <code>false</code> prevents the mina
component from installing a default codec as the first element in the filter
chain. This is useful in scenarios where another filter must be the first in
the filter chain, like the SSL filter.</p></td></tr><tr><td colspan="1"
rowspan="1"
class="confluenceTd"><p><code>disconnectOnNoReply</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.3:</strong> If
sync is enabled then this option dictates MinaConsumer if it should disconnect
where there is no reply to send back.</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>noReplyLogLevel</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>WARN</code></p></td><td
colspan="1" rows
pan="1" class="confluenceTd"><p><strong>Camel 2.3:</strong> If sync is enabled
this option dictates MinaConsumer which logging level to use when logging a
there is no reply to send back. Values are: <code>FATAL, ERROR, INFO, DEBUG,
OFF</code>.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><code>clientMode</code></td><td colspan="1" rowspan="1"
class="confluenceTd"><code>false</code></td><td colspan="1" rowspan="1"
class="confluenceTd"><strong>Camel 2.15:</strong> Consumer only. If the
<code>clientMode</code> is true, mina consumer will connect the address as a
TCP client.</td></tr></tbody></table></div></div>
-
-
-<h3 id="MINA-Usingacustomcodec">Using a custom codec</h3><p>See the <a
shape="rect" class="external-link"
href="http://mina.apache.org/tutorial-on-protocolcodecfilter.html">Mina
documentation</a> how to write your own codec. To use your custom codec with
<code>camel-mina</code>, you should register your codec in the <a shape="rect"
href="registry.html">Registry</a>; for example, by creating a bean in the
Spring XML file. Then use the <code>codec</code> option to specify the bean ID
of your codec. See <a shape="rect" href="hl7.html">HL7</a> that has a custom
codec.</p><h3 id="MINA-Samplewithsync=false">Sample with sync=false</h3><p>In
this sample, Camel exposes a service that listens for TCP connections on port
6200. We use the <strong>textline</strong> codec. In our route, we create a
Mina consumer endpoint that listens on port 6200:</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("mina:tcp://localhost:" + port1 +
"?textline=true&sync=false").to("mock:result");
-]]></script>
-</div></div><p>As the sample is part of a unit test, we test it by sending
some data to it on port 6200.</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[
-MockEndpoint mock = getMockEndpoint("mock:result");
-mock.expectedBodiesReceived("Hello World");
-
-template.sendBody("mina:tcp://localhost:" + port1 +
"?textline=true&sync=false", "Hello World");
-
-assertMockEndpointsSatisfied();
-]]></script>
-</div></div><h3 id="MINA-Samplewithsync=true">Sample with sync=true</h3><p>In
the next sample, we have a more common use case where we expose a TCP service
on port 6201 also use the textline codec. However, this time we want to return
a response, so we set the <code>sync</code> option to <code>true</code> on the
consumer.</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("mina:tcp://localhost:" + port2 +
"?textline=true&sync=true").process(new Processor() {
- public void process(Exchange exchange) throws Exception {
- String body = exchange.getIn().getBody(String.class);
- exchange.getOut().setBody("Bye " + body);
- }
-});
-]]></script>
-</div></div><p>Then we test the sample by sending some data and retrieving the
response using the <code>template.requestBody()</code> method. As we know the
response is a <code>String</code>, we cast it to <code>String</code> and can
assert that the response is, in fact, something we have dynamically set in our
processor code logic.</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[
-String response =
(String)template.requestBody("mina:tcp://localhost:" + port2 +
"?textline=true&sync=true", "World");
-assertEquals("Bye World", response);
-]]></script>
-</div></div><h3 id="MINA-SamplewithSpringDSL">Sample with Spring
DSL</h3><p>Spring DSL can, of course, also be used for <a shape="rect"
href="mina.html">MINA</a>. In the sample below we expose a TCP server on port
5555:</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="mina:tcp://localhost:5555?textline=true"/>
- <to uri="bean:myTCPOrderHandler"/>
+</plain-text-body><p>You can specify a codec in the <a shape="rect"
href="registry.html">Registry</a> using the <strong>codec</strong> option. If
you are using TCP and no codec is specified then the <code>textline</code> flag
is used to determine if text line based codec or object serialization should be
used instead. By default the object serialization is used.</p><p>For UDP if no
codec is specified the default uses a basic <code>ByteBuffer</code> based
codec.</p><p>The VM protocol is used as a direct forwarding mechanism in the
same JVM. See the <a shape="rect" class="external-link"
href="http://mina.apache.org/report/1.1/apidocs/org/apache/mina/transport/vmpipe/package-summary.html">MINA
VM-Pipe API documentation</a> for details.</p><p>A Mina producer has a default
timeout value of 30 seconds, while it waits for a response from the remote
server.</p><p>In normal use, <code>camel-mina</code> only supports marshalling
the body content—message headers and exchange properties a
re not sent.<br clear="none"> However, the option,
<strong>transferExchange</strong>, does allow you to transfer the exchange
itself over the wire. See options below.</p><p>You can append query options to
the URI in the following format,
<code>?option=value&option=value&...</code></p><h3
id="MINA-Options">Options</h3><parameter
ac:name="class">confluenceTableSmall</parameter><rich-text-body><div
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1"
rowspan="1" class="confluenceTh"><p>Option</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>codec</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>You can refer to a named
<code>ProtocolCodecFactory</code> instance in your <a shape="rect" href="
registry.html">Registry</a> such as your Spring
<code>ApplicationContext</code>, which is then used for the
marshalling.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>codec</code></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>You must use the <code>#</code> notation to look up
your codec in the <a shape="rect" href="registry.html">Registry</a>. For
example, use <code>#myCodec</code> to look up a bean with the <code>id</code>
value, <code>myCodec</code>.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>disconnect</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.3:</strong> Whether or not
to disconnect(close) from Mina session right after use. Can be used for both
consumer and producer.</p></td></tr><tr><td colspan="1" rowspan="1
" class="confluenceTd"><p><code>textline</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Only used for TCP. If no codec is
specified, you can use this flag to indicate a text line based codec; if not
specified or the value is <code>false</code>, then Object Serialization is
assumed over TCP.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>textlineDelimiter</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>DEFAULT</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Only used for TCP and if
<strong>textline=true</strong>. Sets the text line delimiter to use. Possible
values are: <code>DEFAULT</code>, <code>AUTO</code>, <code>WINDOWS</code>,
<code>UNIX</code> or <code>MAC</code>. If none provided, Camel will use
<code>DEFAULT</code>. This delimiter is used to mark the end of
text.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>sync</code></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>true</code></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Setting to set endpoint as one-way or
request-response.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>lazySessionCreation</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Sessions can be lazily created
to avoid exceptions, if the remote server is not up and running when the Camel
producer is started.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>timeout</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>30000</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>You can configure the timeout that
specifies how long to wait for a response from a remote server. The timeout
unit is in milliseconds, so 60000 is 60 seconds. T
he timeout is only used for Mina producer.</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 (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 for the TCP textline codec and the UDP
protocol. If not provided, Camel will use 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>transferExchange</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Only used for TCP. You can
transfer th
e exchange over the wire instead of just the body. The following fields are
transferred: In body, Out body, fault body, In headers, Out headers, fault
headers, exchange properties, exchange exception. This requires that the
objects are <em>serializable</em>. Camel will exclude any non-serializable
objects and log it at <code>WARN</code> level.</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>minaLogger</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>You can enable the Apache MINA
logging filter. Apache MINA uses <code>slf4j</code> logging at
<code>INFO</code> level to log all input and output.</p></td></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p><code>filters</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>You can set a list of <a shape="rect" class=
"external-link" href="http://mina.apache.org/iofilter.html">Mina IoFilters</a>
to register. The <code>filters</code> value must be one of the
following:</p><ul><li><strong>Camel 2.2:</strong> comma-separated list of bean
references (e.g. <code>#filterBean1,#filterBean2</code>) where each bean must
be of type <code>org.apache.mina.common.IoFilter</code>.</li><li><strong>before
Camel 2.2:</strong> a reference to a bean of type
<code>List<org.apache.mina.common.IoFilter></code>.</li></ul></td></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p><code>encoderMaxLineLength</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>-1</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>As of 2.1, you can set the
textline protocol encoder max line length. By default the default value of Mina
itself is used which are <code>Integer.MAX_VALUE</code>.</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>decoderMaxLineLength</code
></p></td><td colspan="1" rowspan="1"
>class="confluenceTd"><p><code>-1</code></p></td><td colspan="1" rowspan="1"
>class="confluenceTd"><p>As of 2.1, you can set the textline protocol decoder
>max line length. By default the default value of Mina itself is used which
>are 1024.</p></td></tr><tr><td colspan="1" rowspan="1"
>class="confluenceTd"><p><code>producerPoolSize</code></p></td><td colspan="1"
>rowspan="1" class="confluenceTd"><p>16</p></td><td colspan="1" rowspan="1"
>class="confluenceTd"><p>The TCP producer is thread safe and supports
>concurrency much better. This option allows you to configure the number of
>threads in its thread pool for concurrent producers. <strong>Note:</strong>
>Camel has a pooled service which ensured it was already thread safe and
>supported concurrency already.</p></td></tr><tr><td colspan="1" rowspan="1"
>class="confluenceTd"><p><code>allowDefaultCodec</code></p></td><td
>colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td
>colspan="1
" rowspan="1" class="confluenceTd"><p>The mina component installs a default
codec if both, <code>codec</code> is <code>null</code> and
<code>textline</code> is <code>false</code>. Setting
<code>allowDefaultCodec</code> to <code>false</code> prevents the mina
component from installing a default codec as the first element in the filter
chain. This is useful in scenarios where another filter must be the first in
the filter chain, like the SSL filter.</p></td></tr><tr><td colspan="1"
rowspan="1"
class="confluenceTd"><p><code>disconnectOnNoReply</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.3:</strong> If
sync is enabled then this option dictates MinaConsumer if it should disconnect
where there is no reply to send back.</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>noReplyLogLevel</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p
><code>WARN</code></p></td><td colspan="1" rowspan="1"
>class="confluenceTd"><p><strong>Camel 2.3:</strong> If sync is enabled this
>option dictates MinaConsumer which logging level to use when logging a there
>is no reply to send back. Values are: <code>FATAL, ERROR, INFO, DEBUG,
>OFF</code>.</p></td></tr><tr><td colspan="1" rowspan="1"
>class="confluenceTd"><code>clientMode</code></td><td colspan="1" rowspan="1"
>class="confluenceTd"><code>false</code></td><td colspan="1" rowspan="1"
>class="confluenceTd"><strong>Camel 2.15:</strong> Consumer only. If the
><code>clientMode</code> is true, mina consumer will connect the address as a
>TCP client.</td></tr></tbody></table></div></rich-text-body><h3
>id="MINA-Usingacustomcodec">Using a custom codec</h3><p>See the <a
>shape="rect" class="external-link"
>href="http://mina.apache.org/tutorial-on-protocolcodecfilter.html">Mina
>documentation</a> how to write your own codec. To use your custom codec with
><code>camel-mina</code>, you should register you
r codec in the <a shape="rect" href="registry.html">Registry</a>; for example,
by creating a bean in the Spring XML file. Then use the <code>codec</code>
option to specify the bean ID of your codec. See <a shape="rect"
href="hl7.html">HL7</a> that has a custom codec.</p><h3
id="MINA-Samplewithsync=false">Sample with sync=false</h3><p>In this sample,
Camel exposes a service that listens for TCP connections on port 6200. We use
the <strong>textline</strong> codec. In our route, we create a Mina consumer
endpoint that listens on port
6200:</p><plain-text-body>{snippet:id=e1|lang=java|url=camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaConsumerTest.java}</plain-text-body><p>As
the sample is part of a unit test, we test it by sending some data to it on
port
6200.</p><plain-text-body>{snippet:id=e2|lang=java|url=camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaConsumerTest.java}</plain-text-body><h3
id="MINA-Samplewith
sync=true">Sample with sync=true</h3><p>In the next sample, we have a more
common use case where we expose a TCP service on port 6201 also use the
textline codec. However, this time we want to return a response, so we set the
<code>sync</code> option to <code>true</code> on the
consumer.</p><plain-text-body>{snippet:id=e3|lang=java|url=camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaConsumerTest.java}</plain-text-body><p>Then
we test the sample by sending some data and retrieving the response using the
<code>template.requestBody()</code> method. As we know the response is a
<code>String</code>, we cast it to <code>String</code> and can assert that the
response is, in fact, something we have dynamically set in our processor code
logic.</p><plain-text-body>{snippet:id=e4|lang=java|url=camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaConsumerTest.java}</plain-text-body><h3
id="MINA-SamplewithSpringDSL">Sample with S
pring DSL</h3><p>Spring DSL can, of course, also be used for <a shape="rect"
href="mina.html">MINA</a>. In the sample below we expose a TCP server on port
5555:</p><parameter ac:name="">xml</parameter><plain-text-body> <route>
+ <from uri="mina:tcp://localhost:5555?textline=true"/>
+ <to uri="bean:myTCPOrderHandler"/>
</route>
-]]></script>
-</div></div><p>In the route above, we expose a TCP server on port 5555 using
the textline codec. We let the Spring bean with ID,
<code>myTCPOrderHandler</code>, handle the request and return a reply. For
instance, the handler bean could be implemented as follows:</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[ public String handleOrder(String payload)
{
+</plain-text-body><p>In the route above, we expose a TCP server on port 5555
using the textline codec. We let the Spring bean with ID,
<code>myTCPOrderHandler</code>, handle the request and return a reply. For
instance, the handler bean could be implemented as follows:</p><parameter
ac:name="">java</parameter><plain-text-body> public String
handleOrder(String payload) {
...
- return "Order: OK"
+ return "Order: OK"
}
-]]></script>
-</div></div><h3
id="MINA-ConfiguringMinaendpointsusingSpringbeanstyle">Configuring Mina
endpoints using Spring bean style</h3><p>Configuration of Mina endpoints is
possible using regular Spring bean style configuration in the Spring
DSL.</p><p>However, in the underlying Apache Mina toolkit, it is relatively
difficult to set up the acceptor and the connector, because you can
<em>not</em> use simple setters. To resolve this difficulty, we leverage the
<code>MinaComponent</code> as a Spring factory bean to configure this for us.
If you really need to configure this yourself, there are setters on the
<code>MinaEndpoint</code> to set these when needed.</p><p>The sample below
shows the factory approach:</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[
-<!-- Creating mina endpoints is a bit complex so we reuse MinaComponnet
- as a factory bean to create our endpoint, this is the easiest to do -->
-<bean id="myMinaFactory"
class="org.apache.camel.component.mina.MinaComponent">
- <!-- we must provide a camel context so we refer to it by its id -->
- <constructor-arg index="0" ref="myCamel"/>
-</bean>
-
-<!-- This is our mina endpoint configured with spring, we will use the
factory above
- to create it for us. The goal is to invoke the createEndpoint method with
the
- mina configuration parameter we defined using the constructor-arg option
-->
-<bean id="myMinaEndpoint"
- factory-bean="myMinaFactory"
- factory-method="createEndpoint">
- <!-- and here we can pass it our configuration -->
- <constructor-arg index="0" ref="myMinaConfig"/>
-</bean>
-
-<!-- this is our mina configuration with plain properties -->
-<bean id="myMinaConfig"
class="org.apache.camel.component.mina.MinaConfiguration">
- <property name="protocol" value="tcp"/>
- <property name="host" value="localhost"/>
- <property name="port" ref="port"/>
- <property name="sync" value="false"/>
-</bean>
-]]></script>
-</div></div><p>And then we can refer to our endpoint directly in the route, as
follows:</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>
- <!-- here we route from or mina endpoint we have defined above -->
- <from ref="myMinaEndpoint"/>
- <to uri="mock:result"/>
-</route>
-]]></script>
-</div></div><h3 id="MINA-ClosingSessionWhenComplete">Closing Session When
Complete</h3><p>When acting as a server you sometimes want to close the session
when, for example, a client conversion is finished. To instruct Camel to close
the session, you should add a header with the key
<code>CamelMinaCloseSessionWhenComplete</code> set to a boolean
<code>true</code> value.</p><p>For instance, the example below will close the
session after it has written the <code>bye</code> message back to the
client:</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("mina:tcp://localhost:8080?sync=true&textline=true").process(new
Processor() {
+</plain-text-body><h3
id="MINA-ConfiguringMinaendpointsusingSpringbeanstyle">Configuring Mina
endpoints using Spring bean style</h3><p>Configuration of Mina endpoints is
possible using regular Spring bean style configuration in the Spring
DSL.</p><p>However, in the underlying Apache Mina toolkit, it is relatively
difficult to set up the acceptor and the connector, because you can
<em>not</em> use simple setters. To resolve this difficulty, we leverage the
<code>MinaComponent</code> as a Spring factory bean to configure this for us.
If you really need to configure this yourself, there are setters on the
<code>MinaEndpoint</code> to set these when needed.</p><p>The sample below
shows the factory
approach:</p><plain-text-body>{snippet:id=e1|lang=xml|url=camel/trunk/components/camel-mina/src/test/resources/org/apache/camel/component/mina/SpringMinaEndpointTest-context.xml}</plain-text-body><p>And
then we can refer to our endpoint directly in the route, as
follows:</p><plain-text-body>{s
nippet:id=e2|lang=xml|url=camel/trunk/components/camel-mina/src/test/resources/org/apache/camel/component/mina/SpringMinaEndpointTest-context.xml}</plain-text-body><h3
id="MINA-ClosingSessionWhenComplete">Closing Session When Complete</h3><p>When
acting as a server you sometimes want to close the session when, for example, a
client conversion is finished. To instruct Camel to close the session, you
should add a header with the key <code>CamelMinaCloseSessionWhenComplete</code>
set to a boolean <code>true</code> value.</p><p>For instance, the example below
will close the session after it has written the <code>bye</code> message back
to the client:</p><parameter ac:name="">java</parameter><plain-text-body>
from("mina:tcp://localhost:8080?sync=true&textline=true").process(new
Processor() {
public void process(Exchange exchange) throws Exception {
String body = exchange.getIn().getBody(String.class);
- exchange.getOut().setBody("Bye " + body);
+ exchange.getOut().setBody("Bye " + body);
exchange.getOut().setHeader(MinaConstants.MINA_CLOSE_SESSION_WHEN_COMPLETE,
true);
}
});
-]]></script>
-</div></div><h3 id="MINA-GettheIoSessionformessage">Get the IoSession for
message</h3><p><strong>Available since Camel 2.1</strong><br clear="none"> You
can get the IoSession from the message header with this key
MinaEndpoint.HEADER_MINA_IOSESSION, and also get the local host address with
the key MinaEndpoint.HEADER_LOCAL_ADDRESS and remote host address with the key
MinaEndpoint.HEADER_REMOTE_ADDRESS.</p><h3
id="MINA-ConfiguringMinafilters">Configuring Mina filters</h3><p>Filters permit
you to use some Mina Filters, such as <code>SslFilter</code>. You can also
implement some customized filters. Please note that <code>codec</code> and
<code>logger</code> are also implemented as Mina filters of type,
<code>IoFilter</code>. Any filters you may define are appended to the end of
the filter chain; that is, after <code>codec</code> and
<code>logger</code>.</p><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 using the
<code>SslFilter</code> you need to add the <code>mina-filter-ssl</code> JAR to
the classpath.</p></div></div><p>For instance, the example below will send a
keep-alive message after 10 seconds of inactivity:</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[public class KeepAliveFilter extends
IoFilterAdapter {
+</plain-text-body><h3 id="MINA-GettheIoSessionformessage">Get the IoSession
for message</h3><p><strong>Available since Camel 2.1</strong><br clear="none">
You can get the IoSession from the message header with this key
MinaEndpoint.HEADER_MINA_IOSESSION, and also get the local host address with
the key MinaEndpoint.HEADER_LOCAL_ADDRESS and remote host address with the key
MinaEndpoint.HEADER_REMOTE_ADDRESS.</p><h3
id="MINA-ConfiguringMinafilters">Configuring Mina filters</h3><p>Filters permit
you to use some Mina Filters, such as <code>SslFilter</code>. You can also
implement some customized filters. Please note that <code>codec</code> and
<code>logger</code> are also implemented as Mina filters of type,
<code>IoFilter</code>. Any filters you may define are appended to the end of
the filter chain; that is, after <code>codec</code> and
<code>logger</code>.</p><rich-text-body><p>If using the <code>SslFilter</code>
you need to add the <code>mina-filter-ssl</code> JAR to the classpath.<
/p></rich-text-body><p>For instance, the example below will send a keep-alive
message after 10 seconds of inactivity:</p><parameter
ac:name="">java</parameter><plain-text-body>public class KeepAliveFilter
extends IoFilterAdapter {
@Override
public void sessionCreated(NextFilter nextFilter, IoSession session)
throws Exception {
@@ -198,21 +111,19 @@ assertEquals("Bye World", resp
@Override
public void sessionIdle(NextFilter nextFilter, IoSession session,
IdleStatus status) throws Exception {
- session.write("NOOP"); // NOOP is a FTP command for keep
alive
+ session.write("NOOP"); // NOOP is a FTP command for keep alive
nextFilter.sessionIdle(session, status);
}
}
-]]></script>
-</div></div><p>As Camel Mina may use a request-reply scheme, the endpoint as a
client would like to drop some message, such as greeting when the connection is
established. For example, when you connect to an FTP server, you will get a
<code>220</code> message with a greeting (<code>220 Welcome to
Pure-FTPd</code>). If you don't drop the message, your request-reply scheme
will be broken.</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[public class DropGreetingFilter extends
IoFilterAdapter {
+</plain-text-body><p>As Camel Mina may use a request-reply scheme, the
endpoint as a client would like to drop some message, such as greeting when the
connection is established. For example, when you connect to an FTP server, you
will get a <code>220</code> message with a greeting (<code>220 Welcome to
Pure-FTPd</code>). If you don't drop the message, your request-reply scheme
will be broken.</p><parameter
ac:name="">java</parameter><plain-text-body>public class DropGreetingFilter
extends IoFilterAdapter {
@Override
public void messageReceived(NextFilter nextFilter, IoSession session,
Object message) throws Exception {
if (message instanceof String) {
String ftpMessage = (String) message;
- // "220" is given as greeting. "200 Zzz" is
given as a response to "NOOP" (keep alive)
- if (ftpMessage.startsWith("220") || or
ftpMessage.startsWith("200 Zzz")) {
+ // "220" is given as greeting. "200 Zzz" is given as a response to
"NOOP" (keep alive)
+ if (ftpMessage.startsWith("220") || or ftpMessage.startsWith("200
Zzz")) {
// Dropping greeting
return;
}
@@ -220,38 +131,34 @@ assertEquals("Bye World", resp
nextFilter.messageReceived(session, message);
}
}
-]]></script>
-</div></div><p>Then, you can configure your endpoint using Spring DSL:</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="myMinaFactory"
class="org.apache.camel.component.mina.MinaComponent">
- <constructor-arg index="0" ref="camelContext" />
+</plain-text-body><p>Then, you can configure your endpoint using Spring
DSL:</p><parameter ac:name="">xml</parameter><plain-text-body><bean
id="myMinaFactory" class="org.apache.camel.component.mina.MinaComponent">
+ <constructor-arg index="0" ref="camelContext" />
</bean>
-<bean id="myMinaEndpoint"
- factory-bean="myMinaFactory"
- factory-method="createEndpoint">
- <constructor-arg index="0" ref="myMinaConfig"/>
+<bean id="myMinaEndpoint"
+ factory-bean="myMinaFactory"
+ factory-method="createEndpoint">
+ <constructor-arg index="0" ref="myMinaConfig"/>
</bean>
-<bean id="myMinaConfig"
class="org.apache.camel.component.mina.MinaConfiguration">
- <property name="protocol" value="tcp" />
- <property name="host" value="localhost" />
- <property name="port" value="2121" />
- <property name="sync" value="true" />
- <property name="minaLogger" value="true" />
- <property name="filters" ref="listFilters"/>
+<bean id="myMinaConfig"
class="org.apache.camel.component.mina.MinaConfiguration">
+ <property name="protocol" value="tcp" />
+ <property name="host" value="localhost" />
+ <property name="port" value="2121" />
+ <property name="sync" value="true" />
+ <property name="minaLogger" value="true" />
+ <property name="filters" ref="listFilters"/>
</bean>
-<bean id="listFilters" class="java.util.ArrayList" >
+<bean id="listFilters" class="java.util.ArrayList" >
<constructor-arg>
- <list value-type="org.apache.mina.common.IoFilter">
- <bean class="com.example.KeepAliveFilter"/>
- <bean class="com.example.DropGreetingFilter"/>
+ <list value-type="org.apache.mina.common.IoFilter">
+ <bean class="com.example.KeepAliveFilter"/>
+ <bean class="com.example.DropGreetingFilter"/>
</list>
</constructor-arg>
</bean>
-]]></script>
-</div></div><p></p><h3 id="MINA-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><ul
class="alternate"><li><a shape="rect" href="mina2.html">MINA2</a></li><li><a
shape="rect" href="netty.html">Netty</a></li></ul></div>
+</plain-text-body><p><parameter ac:name=""><a shape="rect"
href="endpoint-see-also.html">Endpoint See Also</a></parameter></p><ul
class="alternate"><li><a shape="rect" href="mina2.html">MINA2</a></li><li><a
shape="rect" href="netty.html">Netty</a></li></ul></div>
</td>
<td valign="top">
<div class="navigation">