Modified: websites/production/camel/content/how-do-i-configure-endpoints.html
==============================================================================
--- websites/production/camel/content/how-do-i-configure-endpoints.html 
(original)
+++ websites/production/camel/content/how-do-i-configure-endpoints.html Fri Aug 
25 08:22:01 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: How Do I Configure Endpoints?
@@ -86,119 +75,73 @@
        <tbody>
         <tr>
         <td valign="top" width="100%">
-<div class="wiki-content maincontent"><h2 
id="HowDoIConfigureEndpoints?-HowDoIConfigureEndpoints?">How Do I Configure 
Endpoints?</h2><p>There are a few different approaches to configuring 
components and endpoints.</p><h3 id="HowDoIConfigureEndpoints?-UsingJava">Using 
Java</h3><p>You can explicitly configure a <a shape="rect" 
href="component.html">Component</a> using Java code as shown in this <a 
shape="rect" href="walk-through-an-example.html">example</a></p><p>Or you can 
explicitly get hold of an <a shape="rect" href="endpoint.html">Endpoint</a> and 
configure it using Java code as shown in the <a shape="rect" 
href="mock.html">Mock endpoint examples</a>.</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[SomeEndpoint endpoint = 
camelContext.getEndpoint(&quot;someURI&quot;, SomeEndpoint.class);
-endpoint.setSomething(&quot;aValue&quot;);]]></script>
-</div></div><h3 id="HowDoIConfigureEndpoints?-UsingCDI">Using CDI</h3><p>You 
can use <a shape="rect" href="cdi.html">CDI</a> as dependency injection 
framework to configure&#160;your <a shape="rect" 
href="component.html">Component</a>&#160;or <a shape="rect" 
href="endpoint.html">Endpoint</a>&#160;instances.</p><p>For example, to 
configure the SJMS component, you can declare a producer method&#160;in a CDI 
bean:</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[class MyCdiComponent {
+<div class="wiki-content maincontent"><h2 
id="HowDoIConfigureEndpoints?-HowDoIConfigureEndpoints?">How Do I Configure 
Endpoints?</h2><p>There are a few different approaches to configuring 
components and endpoints.</p><h3 id="HowDoIConfigureEndpoints?-UsingJava">Using 
Java</h3><p>You can explicitly configure a <a shape="rect" 
href="component.html">Component</a> using Java code as shown in this <a 
shape="rect" href="walk-through-an-example.html">example</a></p><p>Or you can 
explicitly get hold of an <a shape="rect" href="endpoint.html">Endpoint</a> and 
configure it using Java code as shown in the <a shape="rect" 
href="mock.html">Mock endpoint examples</a>.</p><plain-text-body>SomeEndpoint 
endpoint = camelContext.getEndpoint("someURI", SomeEndpoint.class);
+endpoint.setSomething("aValue");</plain-text-body><h3 
id="HowDoIConfigureEndpoints?-UsingCDI">Using CDI</h3><p>You can use <a 
shape="rect" href="cdi.html">CDI</a> as dependency injection framework to 
configure&#160;your <a shape="rect" href="component.html">Component</a>&#160;or 
<a shape="rect" href="endpoint.html">Endpoint</a>&#160;instances.</p><p>For 
example, to configure the SJMS component, you can declare a producer 
method&#160;in a CDI bean:</p><parameter 
ac:name="language">java</parameter><plain-text-body>class MyCdiComponent {
 
-    @PropertyInject(&quot;jms.maxConnections&quot;)
+    @PropertyInject("jms.maxConnections")
     int maxConnections;
 
     @Produces
-    @Named(&quot;sjms&quot;)
+    @Named("sjms")
     @ApplicationScoped
     SjmsComponent sjms() {
         SjmsComponent component = new SjmsComponent();
-        component.setConnectionFactory(new 
ActiveMQConnectionFactory(&quot;vm://broker?broker.persistent=false&quot;));
+        component.setConnectionFactory(new 
ActiveMQConnectionFactory("vm://broker?broker.persistent=false"));
         component.setConnectionCount(maxConnections);
         return component;
     }
-}]]></script>
-</div></div><p>Then, the component is lazily looked-up by Camel CDI whenever 
it is referenced,&#160;e.g., from the Camel Java DSL:</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[class MyCdiRoute extends RouteBuilder {
+}</plain-text-body><p>Then, the component is lazily looked-up by Camel CDI 
whenever it is referenced,&#160;e.g., from the Camel Java DSL:</p><parameter 
ac:name="language">java</parameter><plain-text-body>class MyCdiRoute extends 
RouteBuilder {
 
     @Override
     public void configure() {
-    from(&quot;sjms:sample.queue&quot;)
-        .log(&quot;Received message [${body}]&quot;);
+    from("sjms:sample.queue")
+        .log("Received message [${body}]");
     }
-}]]></script>
-</div></div><p>Besides, endpoints of that component can be injected in any CDI 
beans, e.g.,</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[class MyCdiBean {
+}</plain-text-body><p>Besides, endpoints of that component can be injected in 
any CDI beans, e.g.,</p><parameter 
ac:name="language">java</parameter><plain-text-body>class MyCdiBean {
 
     @Inject
-    @Uri(&quot;sjms:sample.queue&quot;)
+    @Uri("sjms:sample.queue")
     Endpoint endpoint;
-}]]></script>
-</div></div><h3 id="HowDoIConfigureEndpoints?-UsingGuice">Using 
Guice</h3><p>You can also use <a shape="rect" href="guice.html">Guice</a> as 
the dependency injection framework. For example see the <a shape="rect" 
href="guice-jms-example.html">Guice JMS Example</a>.</p><h3 
id="HowDoIConfigureEndpoints?-UsingSpringXML">Using Spring XML</h3><p>You can 
configure your <a shape="rect" href="component.html">Component</a> or <a 
shape="rect" href="endpoint.html">Endpoint</a> instances in your <a 
shape="rect" href="spring.html">Spring</a> XML 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[
-&lt;camelContext id=&quot;camel&quot; 
xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
-    &lt;jmxAgent id=&quot;agent&quot; disabled=&quot;true&quot;/&gt;
-&lt;/camelContext&gt;
-
-&lt;bean id=&quot;activemq&quot; 
class=&quot;org.apache.activemq.camel.component.ActiveMQComponent&quot;&gt;
-  &lt;property name=&quot;connectionFactory&quot;&gt;
-    &lt;bean 
class=&quot;org.apache.activemq.ActiveMQConnectionFactory&quot;&gt;
-      &lt;property name=&quot;brokerURL&quot; 
value=&quot;vm://localhost?broker.persistent=false&amp;amp;broker.useJmx=false&quot;/&gt;
-    &lt;/bean&gt;
-  &lt;/property&gt;
-&lt;/bean&gt;
-]]></script>
-</div></div>Which allows you to configure a component using some name 
(activemq in the above example), then you can refer to the component using 
<strong><code>activemq:[queue:|topic:]destinationName</code></strong>. This 
works by the&#160;<strong><code>SpringCamelContext</code></strong> lazily 
fetching components from the spring context for the scheme name you use for <a 
shape="rect" href="endpoint.html">Endpoint</a> <a shape="rect" 
href="uris.html">URIs</a><h3 
id="HowDoIConfigureEndpoints?-UsingEndpointURIs">Using Endpoint 
URIs</h3><p>Another approach is to use the URI syntax. The URI syntax supports 
the query notation. So for example with the <a shape="rect" 
href="mail.html">Mail</a> component you can configure the password property via 
the URI</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[pop3://host:port?password=foo
-]]></script>
-</div></div><h4 
id="HowDoIConfigureEndpoints?-ReferencingBeansfromEndpointURIs">Referencing 
Beans from Endpoint URIs</h4><p><strong>From Camel 2.0:</strong></p><p>When 
configuring endpoints using URI syntax you can now refer to beans in the <a 
shape="rect" href="registry.html">Registry</a> using 
the&#160;<strong><code>#</code></strong> notation.<br clear="none"> If the 
parameter value starts with a <code>#</code> sign then Camel will lookup in the 
<a shape="rect" href="registry.html">Registry</a> for a bean of the given type. 
For instance:</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[file://inbox?sorter=#mySpecialFileSorter
-]]></script>
-</div></div><p>Will lookup a bean with the id 
<strong><code>mySpecialFileSorter</code></strong> in the <a shape="rect" 
href="registry.html">Registry</a>.</p><h4 
id="HowDoIConfigureEndpoints?-ConfiguringParameterValuesUsingRawValues,e.g.,suchaspasswords">Configuring
 Parameter Values Using Raw Values, e.g., such as passwords</h4><p><strong>From 
Camel 2.11:</strong></p><p>When configuring endpoint options using URI syntax, 
then the values is by default URI encoded. This can be a problem if you want to 
configure passwords and just use the value <em>as is</em> without any encoding. 
For example you may have a plus sign in the password, which would be decimal 
encoded by default.</p><p>From <strong>Camel 2.11</strong>: we made this easier 
as you can denote a parameter value to be <strong>raw</strong> using the 
following syntax <strong><code>RAW(value)</code></strong> e.g., the value 
starts with <strong><code>RAW(</code></strong> and then ends with the 
parenthesis <strong><code>)</code></str
 ong>. Here is a little example:</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[.to(&quot;ftp:[email protected]?password=RAW(se+re?t&amp;23)&amp;binary=true&quot;
-]]></script>
-</div></div><p>In the above example, we have declare the password value as 
raw, and the actual password would be as typed, e.g., 
<strong><code>se+re?t&amp;23</code></strong>.</p><h4 
id="HowDoIConfigureEndpoints?-UsingPropertyPlaceholders">Using Property 
Placeholders</h4><p>Camel have extensive support for using property 
placeholders, which you can read more <a shape="rect" 
href="using-propertyplaceholder.html">about here</a>. For example in the ftp 
example above we can externalize the password to 
a&#160;<strong><code>.properties</code></strong> file.</p><p>For example 
configuring the property placeholder when using a <a shape="rect" 
href="dsl.html">XML DSL</a>, where we declare the location of the .properties 
file. Though we can also define this in Java code. See the <a shape="rect" 
href="using-propertyplaceholder.html">documentation</a> for more 
details.</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;camelContext ...&gt;
-   &lt;propertyPlaceholder id=&quot;properties&quot; 
location=&quot;myftp.properties&quot;/&gt;
+}</plain-text-body><h3 id="HowDoIConfigureEndpoints?-UsingGuice">Using 
Guice</h3><p>You can also use <a shape="rect" href="guice.html">Guice</a> as 
the dependency injection framework. For example see the <a shape="rect" 
href="guice-jms-example.html">Guice JMS Example</a>.</p><h3 
id="HowDoIConfigureEndpoints?-UsingSpringXML">Using Spring XML</h3><p>You can 
configure your <a shape="rect" href="component.html">Component</a> or <a 
shape="rect" href="endpoint.html">Endpoint</a> instances in your <a 
shape="rect" href="spring.html">Spring</a> XML as 
follows.<plain-text-body>{snippet:id=example|lang=xml|url=camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/jmsRouteUsingSpring.xml}</plain-text-body>Which
 allows you to configure a component using some name (activemq in the above 
example), then you can refer to the component using 
<strong><code>activemq:[queue:|topic:]destinationName</code></strong>. This 
works by the&#160;<strong><code>SpringCamelContext</code
 ></strong> lazily fetching components from the spring context for the scheme 
 >name you use for <a shape="rect" href="endpoint.html">Endpoint</a> <a 
 >shape="rect" href="uris.html">URIs</a></p><h3 
 >id="HowDoIConfigureEndpoints?-UsingEndpointURIs">Using Endpoint 
 >URIs</h3><p>Another approach is to use the URI syntax. The URI syntax 
 >supports the query notation. So for example with the <a shape="rect" 
 >href="mail.html">Mail</a> component you can configure the password property 
 >via the URI</p><plain-text-body>pop3://host:port?password=foo
+</plain-text-body><h4 
id="HowDoIConfigureEndpoints?-ReferencingBeansfromEndpointURIs">Referencing 
Beans from Endpoint URIs</h4><p><strong>From Camel 2.0:</strong></p><p>When 
configuring endpoints using URI syntax you can now refer to beans in the <a 
shape="rect" href="registry.html">Registry</a> using 
the&#160;<strong><code>#</code></strong> notation.<br clear="none"> If the 
parameter value starts with a <code>#</code> sign then Camel will lookup in the 
<a shape="rect" href="registry.html">Registry</a> for a bean of the given type. 
For instance:</p><plain-text-body>file://inbox?sorter=#mySpecialFileSorter
+</plain-text-body><p>Will lookup a bean with the id 
<strong><code>mySpecialFileSorter</code></strong> in the <a shape="rect" 
href="registry.html">Registry</a>.</p><h4 
id="HowDoIConfigureEndpoints?-ConfiguringParameterValuesUsingRawValues,e.g.,suchaspasswords">Configuring
 Parameter Values Using Raw Values, e.g., such as passwords</h4><p><strong>From 
Camel 2.11:</strong></p><p>When configuring endpoint options using URI syntax, 
then the values is by default URI encoded. This can be a problem if you want to 
configure passwords and just use the value <em>as is</em> without any encoding. 
For example you may have a plus sign in the password, which would be decimal 
encoded by default.</p><p>From <strong>Camel 2.11</strong>: we made this easier 
as you can denote a parameter value to be <strong>raw</strong> using the 
following syntax <strong><code>RAW(value)</code></strong> e.g., the value 
starts with <strong><code>RAW(</code></strong> and then ends with the 
parenthesis <strong><code>)</code
 ></strong>. Here is a little 
 >example:</p><plain-text-body>.to("ftp:[email protected]?password=RAW(se+re?t&amp;23)&amp;binary=true"
+</plain-text-body><p>In the above example, we have declare the password value 
as raw, and the actual password would be as typed, e.g., 
<strong><code>se+re?t&amp;23</code></strong>.</p><h4 
id="HowDoIConfigureEndpoints?-UsingPropertyPlaceholders">Using Property 
Placeholders</h4><p>Camel have extensive support for using property 
placeholders, which you can read more <a shape="rect" 
href="using-propertyplaceholder.html">about here</a>. For example in the ftp 
example above we can externalize the password to 
a&#160;<strong><code>.properties</code></strong> file.</p><p>For example 
configuring the property placeholder when using a <a shape="rect" 
href="dsl.html">XML DSL</a>, where we declare the location of the .properties 
file. Though we can also define this in Java code. See the <a shape="rect" 
href="using-propertyplaceholder.html">documentation</a> for more 
details.</p><parameter 
ac:name="language">xml</parameter><plain-text-body>&lt;camelContext ...&gt;
+   &lt;propertyPlaceholder id="properties" location="myftp.properties"/&gt;
    ...
 &lt;/camelContext&gt;
-]]></script>
-</div></div><p>And the Camel route now refers to the placeholder using the 
<strong>{{</strong> key <strong>}}</strong> notation:</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[.to(&quot;ftp:[email protected]?password={{myFtpPassword}}&amp;binary=true&quot;
-]]></script>
-</div></div><p>And have a&#160;<strong><code>myftp.properties</code></strong> 
file with password. Notice we still define the RAW(value) style to ensure the 
password is used <em>as is</em></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[myFtpPassword=RAW(se+re?t&amp;23)
-]]></script>
-</div></div><p>We could still have used the RAW(value) in the Camel route 
instead:</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[.to(&quot;ftp:[email protected]?password=RAW({{myFtpPassword}})&amp;binary=true&quot;
-]]></script>
-</div></div><p>And then we would need to remove the RAW from the properties 
file:</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[myFtpPassword=se+re?t&amp;23
-]]></script>
-</div></div><p>To understand more about property placeholders, read the <a 
shape="rect" href="using-propertyplaceholder.html">documentation</a>.</p><h3 
id="HowDoIConfigureEndpoints?-ConfiguringURIsusingEndpointwithBeanPropertyStyle">Configuring
 URIs using Endpoint with Bean Property Style</h3><p><strong>Available as of 
Camel 2.15</strong></p><div><p>Sometimes configuring endpoint uris may have 
many options, and therefore the URI can become long. In Java DSL you can break 
the URIs into new lines as its just Java code, e.g., just concat the String. 
When using XML DSL then the URI is an attribute, e.g., <strong><code>&lt;from 
uri="bla bla"/&gt;</code></strong>. From <strong>Camel 2.15</strong>: you can 
configure the endpoint separately, and from the routes refer to the endpoints 
using their shorthand IDs.&#160;</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;camelContext ...&gt;
- 
-  &lt;endpoint id=&quot;foo&quot; uri=&quot;ftp://foo@myserver&quot;&gt;
-    &lt;property name=&quot;password&quot; value=&quot;secret&quot;/&gt;
-    &lt;property name=&quot;recursive&quot; value=&quot;true&quot;/&gt;
-    &lt;property name=&quot;ftpClient.dataTimeout&quot; 
value=&quot;30000&quot;/&gt;
-    &lt;property name=&quot;ftpClient.serverLanguageCode&quot; 
value=&quot;fr&quot;/&gt; 
+</plain-text-body><p>And the Camel route now refers to the placeholder using 
the <strong>{{</strong> key <strong>}}</strong> notation:</p><parameter 
ac:name="language">java</parameter><plain-text-body>.to("ftp:[email protected]?password={{myFtpPassword}}&amp;binary=true"
+</plain-text-body><p>And have 
a&#160;<strong><code>myftp.properties</code></strong> file with password. 
Notice we still define the RAW(value) style to ensure the password is used 
<em>as is</em></p><plain-text-body>myFtpPassword=RAW(se+re?t&amp;23)
+</plain-text-body><p>We could still have used the RAW(value) in the Camel 
route instead:</p><parameter 
ac:name="language">java</parameter><plain-text-body>.to("ftp:[email protected]?password=RAW({{myFtpPassword}})&amp;binary=true"
+</plain-text-body><p>And then we would need to remove the RAW from the 
properties file:</p><plain-text-body>myFtpPassword=se+re?t&amp;23
+</plain-text-body><p>To understand more about property placeholders, read the 
<a shape="rect" href="using-propertyplaceholder.html">documentation</a>.</p><h3 
id="HowDoIConfigureEndpoints?-ConfiguringURIsusingEndpointwithBeanPropertyStyle">Configuring
 URIs using Endpoint with Bean Property Style</h3><p><strong>Available as of 
Camel 2.15</strong></p><div><p>Sometimes configuring endpoint uris may have 
many options, and therefore the URI can become long. In Java DSL you can break 
the URIs into new lines as its just Java code, e.g., just concat the String. 
When using XML DSL then the URI is an attribute, e.g., <strong><code>&lt;from 
uri="bla bla"/&gt;</code></strong>. From <strong>Camel 2.15</strong>: you can 
configure the endpoint separately, and from the routes refer to the endpoints 
using their shorthand IDs.&#160;</p><parameter 
ac:name="language">xml</parameter><plain-text-body>&lt;camelContext ...&gt;
+&#160;
+  &lt;endpoint id="foo" uri="ftp://foo@myserver"&gt;
+    &lt;property name="password" value="secret"/&gt;
+    &lt;property name="recursive" value="true"/&gt;
+    &lt;property name="ftpClient.dataTimeout" value="30000"/&gt;
+    &lt;property name="ftpClient.serverLanguageCode" value="fr"/&gt;&#160;
   &lt;/endpoint&gt;
- 
+&#160;
   &lt;route&gt;
-    &lt;from uri=&quot;ref:foo&quot;/&gt;
+    &lt;from uri="ref:foo"/&gt;
     ...
   &lt;/route&gt;
-&lt;/camelContext&gt;]]></script>
-</div></div><p>&#160;</p><p>In the example above, the endpoint with id foo, is 
defined using&#160;<strong><code>&lt;endpoint&gt;</code></strong> which under 
the covers assembles this as an URI, with all the options, as if you have 
defined all the options directly in the URI. You can still configure some 
options in the URI, and then 
use&#160;<strong><code>&lt;property&gt;</code></strong> style for additional 
options, or to override options from the URI, such as:</p><div class="code 
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;endpoint id=&quot;foo&quot; 
uri=&quot;ftp://foo@myserver?recursive=true&quot;&gt;
-  &lt;property name=&quot;password&quot; value=&quot;secret&quot;/&gt;
-  &lt;property name=&quot;ftpClient.dataTimeout&quot; 
value=&quot;30000&quot;/&gt;
-  &lt;property name=&quot;ftpClient.serverLanguageCode&quot; 
value=&quot;fr&quot;/&gt; 
-&lt;/endpoint&gt;]]></script>
-</div></div><p>&#160;</p></div><h3 
id="HowDoIConfigureEndpoints?-ConfiguringLongURIsUsingNewLines">Configuring 
Long URIs Using New Lines</h3><p><strong>Available as of Camel 
2.15</strong></p><p>Sometimes configuring endpoint URIs may have many options, 
and therefore the URI can become long. In Java DSL you can break the URIs into 
new lines as its just Java code, e.g., just concat the String. When using XML 
DSL then the URI is an attribute, e.g., <strong><code>&lt;from uri="bla 
bla"/&gt;</code></strong>. From <strong>Camel 2.15</strong>: you can break the 
URI attribute using new line, such as shown below:</p><div class="code panel 
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;route&gt;
-  &lt;from uri=&quot;ftp://foo@myserver?password=secret&amp;amp;
+&lt;/camelContext&gt;</plain-text-body><p>&#160;</p><p>In the example above, 
the endpoint with id foo, is defined 
using&#160;<strong><code>&lt;endpoint&gt;</code></strong> which under the 
covers assembles this as an URI, with all the options, as if you have defined 
all the options directly in the URI. You can still configure some options in 
the URI, and then use&#160;<strong><code>&lt;property&gt;</code></strong> style 
for additional options, or to override options from the URI, such 
as:</p><parameter 
ac:name="language">xml</parameter><plain-text-body>&lt;endpoint id="foo" 
uri="ftp://foo@myserver?recursive=true"&gt;
+  &lt;property name="password" value="secret"/&gt;
+  &lt;property name="ftpClient.dataTimeout" value="30000"/&gt;
+  &lt;property name="ftpClient.serverLanguageCode" value="fr"/&gt; 
+&lt;/endpoint&gt;</plain-text-body><p>&#160;</p></div><h3 
id="HowDoIConfigureEndpoints?-ConfiguringLongURIsUsingNewLines">Configuring 
Long URIs Using New Lines</h3><p><strong>Available as of Camel 
2.15</strong></p><p>Sometimes configuring endpoint URIs may have many options, 
and therefore the URI can become long. In Java DSL you can break the URIs into 
new lines as its just Java code, e.g., just concat the String. When using XML 
DSL then the URI is an attribute, e.g., <strong><code>&lt;from uri="bla 
bla"/&gt;</code></strong>. From <strong>Camel 2.15</strong>: you can break the 
URI attribute using new line, such as shown below:</p><parameter 
ac:name="language">xml</parameter><plain-text-body>&lt;route&gt;
+  &lt;from uri="ftp://foo@myserver?password=secret&amp;amp;
            recursive=true&amp;amp;
            ftpClient.dataTimeout=30000&amp;amp;
-           ftpClientConfig.serverLanguageCode=fr&quot;/&gt;
-  &lt;to uri=&quot;bean:doSomething&quot;/&gt;
-&lt;/route&gt;]]></script>
-</div></div><p>Notice that it still requires to use 
escape&#160;<strong><code>&amp;</code></strong> 
as&#160;<strong><code>&amp;amp;</code></strong> in XML. Also you can have 
multiple options in one line, e.g., this is the same:</p><div class="code panel 
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;route&gt;
-  &lt;from uri=&quot;ftp://foo@myserver?password=secret&amp;amp;
+           ftpClientConfig.serverLanguageCode=fr"/&gt;
+  &lt;to uri="bean:doSomething"/&gt;
+&lt;/route&gt;</plain-text-body><p>Notice that it still requires to use 
escape&#160;<strong><code>&amp;</code></strong> 
as&#160;<strong><code>&amp;amp;</code></strong> in XML. Also you can have 
multiple options in one line, e.g., this is the same:</p><parameter 
ac:name="language">xml</parameter><plain-text-body>&lt;route&gt;
+  &lt;from uri="ftp://foo@myserver?password=secret&amp;amp;
            recursive=true&amp;amp;ftpClient.dataTimeout=30000&amp;amp;
-           ftpClientConfig.serverLanguageCode=fr&quot;/&gt;
-  &lt;to uri=&quot;bean:doSomething&quot;/&gt;
-&lt;/route&gt;]]></script>
-</div></div><h2 id="HowDoIConfigureEndpoints?-SeeAlso"><span 
style="line-height: 1.5;">See Also</span></h2><ul><li><a shape="rect" 
href="how-do-i-add-a-component.html">How do I add a component</a></li><li><a 
shape="rect" href="spring.html">Spring</a></li><li><a shape="rect" 
href="uris.html">URIs</a></li><li><a shape="rect" 
href="using-propertyplaceholder.html">Using 
PropertyPlaceholder</a></li></ul></div>
+           ftpClientConfig.serverLanguageCode=fr"/&gt;
+  &lt;to uri="bean:doSomething"/&gt;
+&lt;/route&gt;</plain-text-body><h2 
id="HowDoIConfigureEndpoints?-SeeAlso"><span style="line-height: 1.5;">See 
Also</span></h2><ul><li><a shape="rect" 
href="how-do-i-add-a-component.html">How do I add a component</a></li><li><a 
shape="rect" href="spring.html">Spring</a></li><li><a shape="rect" 
href="uris.html">URIs</a></li><li><a shape="rect" 
href="using-propertyplaceholder.html">Using 
PropertyPlaceholder</a></li></ul></div>
         </td>
         <td valign="top">
           <div class="navigation">

Modified: 
websites/production/camel/content/how-do-i-import-routes-from-other-xml-files.html
==============================================================================
--- 
websites/production/camel/content/how-do-i-import-routes-from-other-xml-files.html
 (original)
+++ 
websites/production/camel/content/how-do-i-import-routes-from-other-xml-files.html
 Fri Aug 25 08:22:01 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: How Do I Import Routes From Other XML Files?
@@ -86,49 +75,7 @@
        <tbody>
         <tr>
         <td valign="top" width="100%">
-<div class="wiki-content maincontent"><h2 
id="HowDoIImportRoutesFromOtherXMLFiles?-HowDoIImportRoutesFromOtherXMLFiles?">How
 Do I Import Routes From Other XML Files?</h2><p><strong>Available as of Camel 
2.3</strong></p><p>When defining routes in Camel using <a shape="rect" 
href="xml-configuration.html">Xml Configuration</a> you may want to define some 
routes in other XML files. For example you may have many routes and it may help 
to maintain the application if some of the routes are in separate XML files. 
You may also want to store common and reusable routes in other XML files, which 
you can simply import when needed.</p><p>In <strong>Camel 2.3</strong> it is 
now possible to define routes outside 
<strong><code>&lt;camelContext/&gt;</code></strong> which you do in a new 
<strong><code>&lt;routeContext/&gt;</code></strong> tag.</p><div 
class="confluence-information-macro 
confluence-information-macro-information"><span class="aui-icon aui-icon-small 
aui-iconfont-info confluence-informat
 ion-macro-icon"></span><div 
class="confluence-information-macro-body"><p><strong>Notice:</strong> When you 
use&#160;<strong><code>&lt;routeContext&gt;</code></strong> then they are 
separated, and cannot reuse existing 
<strong><code>&lt;onException&gt;</code></strong>, 
<strong><code>&lt;intercept&gt;</code></strong>,&#160;<strong><code>&lt;dataFormats&gt;</code></strong>
 and similar cross cutting functionality defined in the 
<strong><code>&lt;camelContext&gt;</code></strong>. In other words 
the&#160;<strong><code>&lt;routeContext&gt;</code></strong> is currently 
isolated. This may change in Camel 3.x.</p></div></div><p>For example we could 
have a file named <strong><code>myCoolRoutes.xml</code></strong> which contains 
a couple of routes as shown:</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeHeader panelHeader pdl" 
style="border-bottom-width: 1px;"><b>myCoolRoutes.xml</b></div><div 
class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
-&lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot;
-       xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
-       xsi:schemaLocation=&quot;
-       http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd
-       http://camel.apache.org/schema/spring 
http://camel.apache.org/schema/spring/camel-spring.xsd
-    &quot;&gt;
-
-    &lt;!-- this is an included XML file where we only the the routeContext 
--&gt;
-    &lt;routeContext id=&quot;myCoolRoutes&quot; 
xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
-        &lt;!-- we can have a route --&gt;
-        &lt;route id=&quot;cool&quot;&gt;
-            &lt;from uri=&quot;direct:start&quot;/&gt;
-            &lt;to uri=&quot;mock:result&quot;/&gt;
-        &lt;/route&gt;
-        &lt;!-- and another route, you can have as many your like --&gt;
-        &lt;route id=&quot;bar&quot;&gt;
-            &lt;from uri=&quot;direct:bar&quot;/&gt;
-            &lt;to uri=&quot;mock:bar&quot;/&gt;
-        &lt;/route&gt;
-    &lt;/routeContext&gt;
-
-&lt;/beans&gt;
-]]></script>
-</div></div>Then in your XML file which contains the CamelContext you can use 
Spring to import the <strong><code>myCoolRoute.xml</code></strong> file. And 
then inside <strong><code>&lt;camelContext/&gt;</code></strong> you can refer 
to the <strong><code>&lt;routeContext/&gt;</code></strong> by 
its&#160;<strong><code>id</code></strong> as shown below:<div class="code panel 
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
-&lt;!-- import the routes from another XML file --&gt;
-&lt;import resource=&quot;myCoolRoutes.xml&quot;/&gt;
-
-&lt;camelContext xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
-
-    &lt;!-- refer to a given route to be used --&gt;
-    &lt;routeContextRef ref=&quot;myCoolRoutes&quot;/&gt;
-
-    &lt;!-- we can of course still use routes inside camelContext --&gt;
-    &lt;route id=&quot;inside&quot;&gt;
-        &lt;from uri=&quot;direct:inside&quot;/&gt;
-        &lt;to uri=&quot;mock:inside&quot;/&gt;
-    &lt;/route&gt;
-&lt;/camelContext&gt;
-]]></script>
-</div></div>Also notice that you can mix and match, having routes 
inside&#160;<strong><code>CamelContext</code></strong> and also externalized in 
<strong><code>RouteContext</code></strong>.<p>You can have as many 
<strong><code>&lt;routeContextRef/&gt;</code></strong> as you like.</p><div 
class="confluence-information-macro confluence-information-macro-tip"><p 
class="title">Reusable routes</p><span class="aui-icon aui-icon-small 
aui-iconfont-approve confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>The routes defined in 
<strong><code>&lt;routeContext/&gt;</code></strong> can be reused by multiple 
<strong><code>&lt;camelContext/&gt;</code></strong>. However its only the 
definition which is reused. At runtime 
each&#160;<strong><code>CamelContext</code></strong> will create its own 
instance of the route based on the definition.</p></div></div></div>
+<div class="wiki-content maincontent"><h2 
id="HowDoIImportRoutesFromOtherXMLFiles?-HowDoIImportRoutesFromOtherXMLFiles?">How
 Do I Import Routes From Other XML Files?</h2><p><strong>Available as of Camel 
2.3</strong></p><p>When defining routes in Camel using <a shape="rect" 
href="xml-configuration.html">Xml Configuration</a> you may want to define some 
routes in other XML files. For example you may have many routes and it may help 
to maintain the application if some of the routes are in separate XML files. 
You may also want to store common and reusable routes in other XML files, which 
you can simply import when needed.</p><p>In <strong>Camel 2.3</strong> it is 
now possible to define routes outside 
<strong><code>&lt;camelContext/&gt;</code></strong> which you do in a new 
<strong><code>&lt;routeContext/&gt;</code></strong> 
tag.</p><rich-text-body><p><strong>Notice:</strong> When you 
use&#160;<strong><code>&lt;routeContext&gt;</code></strong> then they are 
separated, and cannot reuse ex
 isting <strong><code>&lt;onException&gt;</code></strong>, 
<strong><code>&lt;intercept&gt;</code></strong>,&#160;<strong><code>&lt;dataFormats&gt;</code></strong>
 and similar cross cutting functionality defined in the 
<strong><code>&lt;camelContext&gt;</code></strong>. In other words 
the&#160;<strong><code>&lt;routeContext&gt;</code></strong> is currently 
isolated. This may change in Camel 3.x.</p></rich-text-body><p>For example we 
could have a file named <strong><code>myCoolRoutes.xml</code></strong> which 
contains a couple of routes as 
shown:<plain-text-body>{snippet:id=e1|lang=xml|title=myCoolRoutes.xml|url=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/myCoolRoutes.xml}</plain-text-body>Then
 in your XML file which contains the CamelContext you can use Spring to import 
the <strong><code>myCoolRoute.xml</code></strong> file. And then inside 
<strong><code>&lt;camelContext/&gt;</code></strong> you can refer to the 
<strong><code>&lt;routeContext/
 &gt;</code></strong> by its&#160;<strong><code>id</code></strong> as shown 
below:<plain-text-body>{snippet:id=e1|lang=xml|url=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/RouteRefIncludeXmlFileTest.xml}</plain-text-body>Also
 notice that you can mix and match, having routes 
inside&#160;<strong><code>CamelContext</code></strong> and also externalized in 
<strong><code>RouteContext</code></strong>.</p><p>You can have as many 
<strong><code>&lt;routeContextRef/&gt;</code></strong> as you 
like.</p><parameter ac:name="title">Reusable 
routes</parameter><rich-text-body><p>The routes defined in 
<strong><code>&lt;routeContext/&gt;</code></strong> can be reused by multiple 
<strong><code>&lt;camelContext/&gt;</code></strong>. However its only the 
definition which is reused. At runtime 
each&#160;<strong><code>CamelContext</code></strong> will create its own 
instance of the route based on the definition.</p></rich-text-body></div>
         </td>
         <td valign="top">
           <div class="navigation">

Modified: websites/production/camel/content/idempotent-consumer.html
==============================================================================
--- websites/production/camel/content/idempotent-consumer.html (original)
+++ websites/production/camel/content/idempotent-consumer.html Fri Aug 25 
08:22:01 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: Idempotent Consumer
@@ -86,93 +75,10 @@
        <tbody>
         <tr>
         <td valign="top" width="100%">
-<div class="wiki-content maincontent"><h3 
id="IdempotentConsumer-IdempotentConsumer">Idempotent Consumer</h3><p>The <a 
shape="rect" class="external-link" 
href="http://www.enterpriseintegrationpatterns.com/IdempotentReceiver.html"; 
rel="nofollow">Idempotent Consumer</a> from the <a shape="rect" 
href="enterprise-integration-patterns.html">EIP patterns</a> is used to filter 
out duplicate messages.</p><p>This pattern is implemented using the <a 
shape="rect" class="external-link" 
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/processor/idempotent/IdempotentConsumer.html";>IdempotentConsumer</a>
 class. This uses an <a shape="rect" href="expression.html">Expression</a> to 
calculate a unique message ID string for a given message exchange; this ID can 
then be looked up in the <a shape="rect" class="external-link" 
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/spi/IdempotentRepository.html";>IdempotentRepository</a>
 to see if it h
 as been seen before; if it has the message is consumed; if its not then the 
message is processed and the ID is added to the repository.</p><p>The 
Idempotent Consumer essentially acts like a <a shape="rect" 
href="message-filter.html">Message Filter</a> to filter out 
duplicates.</p><p>Camel will add the message id eagerly to the repository to 
detect duplication also for Exchanges currently in progress.<br clear="none"> 
On completion Camel will remove the message id from the repository if the 
Exchange failed, otherwise it stays there.</p><p>Camel provides the following 
Idempotent Consumer implementations:</p><ul 
class="alternate"><li>MemoryIdempotentRepository</li><li><a shape="rect" 
href="file2.html">FileIdempotentRepository</a></li><li><a shape="rect" 
href="hazelcast-component.html">HazelcastIdempotentRepository</a> 
(<strong>Available as of Camel 2.8</strong>)</li><li><a shape="rect" 
href="sql-component.html">JdbcMessageIdRepository</a> (<strong>Available as of 
Camel 2.7</strong>)</l
 i><li><a shape="rect" href="jpa.html">JpaMessageIdRepository</a></li><li><p><a 
shape="rect" href="infinispan.html">InfinispanIdempotentRepository</a> 
(<strong>Available as of Camel 2.13.0)</strong></p></li><li><p><a shape="rect" 
href="jcache.html">JCacheIdempotentRepository</a><strong>&#160;(<strong>Available
 as of Camel 2.17.0)</strong></strong></p></li><li><p><a shape="rect" 
href="spring.html">SpringCacheIdempotentRepository</a>&#160;<strong>(<strong>Available
 as of Camel 2.17.1)</strong></strong><strong><strong><br 
clear="none"></strong></strong></p></li><li><p><a shape="rect" 
href="ehcache.html">EhcacheIdempotentRepository</a><strong><strong>&#160;<strong>(<strong>Available
 as of Camel 2.18.0)</strong></strong></strong></strong></p></li><li><a 
shape="rect" href="kafka.html">KafkaIdempotentRepository</a> (<strong>Available 
as of Camel 2.19.0)</strong></li></ul><h3 
id="IdempotentConsumer-Options">Options</h3><p>The Idempotent Consumer has the 
following options:</p><div class="tabl
 e-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</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p>eager</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>true</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Eager controls whether Camel adds the message to the 
repository before or after the exchange has been processed. If enabled before 
then Camel will be able to detect duplicate messages even when messages are 
currently in progress. By disabling Camel will only detect duplicates when a 
message has successfully been processed.</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p>messageIdRepositoryRef</p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td 
colspan="1" rowspan="1" class="confluence
 Td"><p>A reference to a <code>IdempotentRepository</code> to lookup in the 
registry. This option is mandatory when using XML DSL.</p></td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><p>skipDuplicate</p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>true</p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><strong>Camel 2.8:</strong> Sets whether to 
skip duplicate messages. If set to <code>false</code> then the message will be 
continued. However the <a shape="rect" href="exchange.html">Exchange</a> has 
been marked as a duplicate by having the <code>Exchange.DUPLICATE_MESSAG</code> 
exchange property set to a <code>Boolean.TRUE</code> 
value.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>removeOnFailure</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>true</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><strong>Camel 2.9:</strong> Sets whether to remove the 
id of an Exchange that failed.</p></td></tr><tr><td co
 lspan="1" rowspan="1" class="confluenceTd">completionEager</td><td colspan="1" 
rowspan="1" class="confluenceTd">false</td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><strong>Camel 2.16:</strong> Sets whether to complete 
the idempotent consumer eager or when the exchange is done.</p><p>If this 
option is true to complete eager, then the idempotent consumer will trigger its 
completion when the exchange reached the end of the block of the idempotent 
consumer pattern. So if the exchange is continued routed after the block ends, 
then whatever happens there does not affect the state.</p><p>If this option is 
false (default) to not complete eager, then the idempotent consumer will 
complete when the exchange is done being routed. So if the exchange is 
continued routed after the block ends, then whatever happens there also affect 
the state. For example if the exchange failed due to an exception, then the 
state of the idempotent consumer will be a 
rollback.</p></td></tr></tbody></table>
 </div><h3 id="IdempotentConsumer-Usingthe"><strong>Using the <a shape="rect" 
href="fluent-builders.html">Fluent Builders</a></strong></h3><p>The following 
example will use the header <strong>myMessageId</strong> to filter out 
duplicates</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[
-RouteBuilder builder = new RouteBuilder() {
-    public void configure() {
-        errorHandler(deadLetterChannel(&quot;mock:error&quot;));
+<div class="wiki-content maincontent"><h3 
id="IdempotentConsumer-IdempotentConsumer">Idempotent Consumer</h3><p>The <a 
shape="rect" class="external-link" 
href="http://www.enterpriseintegrationpatterns.com/IdempotentReceiver.html"; 
rel="nofollow">Idempotent Consumer</a> from the <a shape="rect" 
href="enterprise-integration-patterns.html">EIP patterns</a> is used to filter 
out duplicate messages.</p><p>This pattern is implemented using the <a 
shape="rect" class="external-link" 
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/processor/idempotent/IdempotentConsumer.html";>IdempotentConsumer</a>
 class. This uses an <a shape="rect" href="expression.html">Expression</a> to 
calculate a unique message ID string for a given message exchange; this ID can 
then be looked up in the <a shape="rect" class="external-link" 
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/spi/IdempotentRepository.html";>IdempotentRepository</a>
 to see if it h
 as been seen before; if it has the message is consumed; if its not then the 
message is processed and the ID is added to the repository.</p><p>The 
Idempotent Consumer essentially acts like a <a shape="rect" 
href="message-filter.html">Message Filter</a> to filter out 
duplicates.</p><p>Camel will add the message id eagerly to the repository to 
detect duplication also for Exchanges currently in progress.<br clear="none"> 
On completion Camel will remove the message id from the repository if the 
Exchange failed, otherwise it stays there.</p><p>Camel provides the following 
Idempotent Consumer implementations:</p><ul 
class="alternate"><li>MemoryIdempotentRepository</li><li><a shape="rect" 
href="file2.html">FileIdempotentRepository</a></li><li><a shape="rect" 
href="hazelcast-component.html">HazelcastIdempotentRepository</a> 
(<strong>Available as of Camel 2.8</strong>)</li><li><a shape="rect" 
href="sql-component.html">JdbcMessageIdRepository</a> (<strong>Available as of 
Camel 2.7</strong>)</l
 i><li><a shape="rect" href="jpa.html">JpaMessageIdRepository</a></li><li><p><a 
shape="rect" href="infinispan.html">InfinispanIdempotentRepository</a> 
(<strong>Available as of Camel 2.13.0)</strong></p></li><li><p><a shape="rect" 
href="jcache.html">JCacheIdempotentRepository</a><strong>&#160;(<strong>Available
 as of Camel 2.17.0)</strong></strong></p></li><li><p><a shape="rect" 
href="spring.html">SpringCacheIdempotentRepository</a>&#160;<strong>(<strong>Available
 as of Camel 2.17.1)</strong></strong><strong><strong><br 
clear="none"></strong></strong></p></li><li><p><a shape="rect" 
href="ehcache.html">EhcacheIdempotentRepository</a><strong><strong>&#160;<strong>(<strong>Available
 as of Camel 2.18.0)</strong></strong></strong></strong></p></li><li><a 
shape="rect" href="kafka.html">KafkaIdempotentRepository</a> (<strong>Available 
as of Camel 2.19.0)</strong></li></ul><h3 
id="IdempotentConsumer-Options">Options</h3><p>The Idempotent Consumer has the 
following options:</p><div class="tabl
 e-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</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p>eager</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>true</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Eager controls whether Camel adds the message to the 
repository before or after the exchange has been processed. If enabled before 
then Camel will be able to detect duplicate messages even when messages are 
currently in progress. By disabling Camel will only detect duplicates when a 
message has successfully been processed.</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p>messageIdRepositoryRef</p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td 
colspan="1" rowspan="1" class="confluence
 Td"><p>A reference to a <code>IdempotentRepository</code> to lookup in the 
registry. This option is mandatory when using XML DSL.</p></td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><p>skipDuplicate</p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>true</p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><strong>Camel 2.8:</strong> Sets whether to 
skip duplicate messages. If set to <code>false</code> then the message will be 
continued. However the <a shape="rect" href="exchange.html">Exchange</a> has 
been marked as a duplicate by having the <code>Exchange.DUPLICATE_MESSAG</code> 
exchange property set to a <code>Boolean.TRUE</code> 
value.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>removeOnFailure</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>true</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><strong>Camel 2.9:</strong> Sets whether to remove the 
id of an Exchange that failed.</p></td></tr><tr><td co
 lspan="1" rowspan="1" class="confluenceTd">completionEager</td><td colspan="1" 
rowspan="1" class="confluenceTd">false</td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><strong>Camel 2.16:</strong> Sets whether to complete 
the idempotent consumer eager or when the exchange is done.</p><p>If this 
option is true to complete eager, then the idempotent consumer will trigger its 
completion when the exchange reached the end of the block of the idempotent 
consumer pattern. So if the exchange is continued routed after the block ends, 
then whatever happens there does not affect the state.</p><p>If this option is 
false (default) to not complete eager, then the idempotent consumer will 
complete when the exchange is done being routed. So if the exchange is 
continued routed after the block ends, then whatever happens there also affect 
the state. For example if the exchange failed due to an exception, then the 
state of the idempotent consumer will be a 
rollback.</p></td></tr></tbody></table>
 </div><h3 id="IdempotentConsumer-Usingthe"><strong>Using the <a shape="rect" 
href="fluent-builders.html">Fluent Builders</a></strong></h3><p>The following 
example will use the header <strong>myMessageId</strong> to filter out 
duplicates<plain-text-body>{snippet:id=idempotent|lang=java|url=camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java}</plain-text-body>The
 above <a shape="rect" class="external-link" 
href="https://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java";>example</a>
 will use an in-memory based <a shape="rect" class="external-link" 
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/processor/idempotent/MessageIdRepository.html";>MessageIdRepository</a>
 which can easily run out of memory and doesn't work in a clustered 
environment. So you might prefer to use the JPA based implementation which uses 
a database to store the message IDs which have been proce
 
ssed<plain-text-body>{snippet:id=idempotent|lang=java|url=camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/processor/jpa/JpaIdempotentConsumerTest.java}</plain-text-body>In
 the above <a shape="rect" class="external-link" 
href="https://svn.apache.org/repos/asf/camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/processor/jpa/JpaIdempotentConsumerTest.java";>example</a>
 we are using the header <strong>messageId</strong> to filter out duplicates 
and using the collection <strong>myProcessorName</strong> to indicate the 
Message ID Repository to use. This name is important as you could process the 
same message by many different processors; so each may require its own logical 
Message ID Repository.</p><p>For further examples of this pattern in use you 
could look at the <a shape="rect" class="external-link" 
href="http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/IdempotentConsumerTest.java?view=markup";>junit
 test case</a><
 /p><h3 id="IdempotentConsumer-SpringXMLexample">Spring XML example</h3><p>The 
following example will use the header <strong>myMessageId</strong> to filter 
out 
duplicates<plain-text-body>{snippet:id=e1|lang=xml|url=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringIdempotentConsumerTest.xml}</plain-text-body></p><h3
 id="IdempotentConsumer-Howtohandleduplicatemessagesintheroute">How to handle 
duplicate messages in the route</h3><p><strong>Available as of Camel 
2.8</strong></p><p>You can now set the <code>skipDuplicate</code> option to 
<code>false</code> which instructs the idempotent consumer to route duplicate 
messages as well. However the duplicate message has been marked as duplicate by 
having a property on the <a shape="rect" href="exchange.html">Exchange</a> set 
to true. We can leverage this fact by using a <a shape="rect" 
href="content-based-router.html">Content Based Router</a> or <a shape="rect" 
href="message-filter.html">Message Fi
 lter</a> to detect this and handle duplicate messages.</p><p>For example in 
the following example we use the <a shape="rect" 
href="message-filter.html">Message Filter</a> to send the message to a 
duplicate endpoint, and then stop continue routing that 
message.<plain-text-body>{snippet:id=e1|lang=java|title=Filter duplicate 
messages|url=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/IdempotentConsumerTest.java}</plain-text-body>The
 sample example in XML DSL would 
be:<plain-text-body>{snippet:id=e1|lang=xml|title=Filter duplicate 
messages|url=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringIdempotentConsumerNoSkipDuplicateFilterTest.xml}</plain-text-body></p><h3
 
id="IdempotentConsumer-Howtohandleduplicatemessageinaclusteredenvironmentwithadatagrid">How
 to handle duplicate message in a clustered environment with a data 
grid</h3><p><strong>Available as of Camel 2.8</strong></p><p>If you have 
running Camel in a clustered env
 ironment, a in memory idempotent repository doesn't work (see above). You can 
setup either a central database or use the idempotent consumer implementation 
based on the <a shape="rect" class="external-link" 
href="http://www.hazelcast.com/"; rel="nofollow">Hazelcast</a> data grid. 
Hazelcast finds the nodes over multicast (which is default - configure 
Hazelcast for tcp-ip) and creates automatically a map based 
repository:</p><parameter ac:name="">java</parameter><plain-text-body>  
HazelcastIdempotentRepository idempotentRepo = new 
HazelcastIdempotentRepository("myrepo");
 
-        from(&quot;direct:a&quot;)
-            .idempotentConsumer(header(&quot;myMessageId&quot;),
-                    MemoryIdempotentRepository.memoryIdempotentRepository(200))
-            .to(&quot;direct:b&quot;);
-    }
-};
-]]></script>
-</div></div>The above <a shape="rect" class="external-link" 
href="https://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java";>example</a>
 will use an in-memory based <a shape="rect" class="external-link" 
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/processor/idempotent/MessageIdRepository.html";>MessageIdRepository</a>
 which can easily run out of memory and doesn't work in a clustered 
environment. So you might prefer to use the JPA based implementation which uses 
a database to store the message IDs which have been processed<div class="code 
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
-from(&quot;direct:start&quot;).idempotentConsumer(
-        header(&quot;messageId&quot;),
-        jpaMessageIdRepository(lookup(EntityManagerFactory.class), 
PROCESSOR_NAME)
-).to(&quot;mock:result&quot;);
-]]></script>
-</div></div>In the above <a shape="rect" class="external-link" 
href="https://svn.apache.org/repos/asf/camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/processor/jpa/JpaIdempotentConsumerTest.java";>example</a>
 we are using the header <strong>messageId</strong> to filter out duplicates 
and using the collection <strong>myProcessorName</strong> to indicate the 
Message ID Repository to use. This name is important as you could process the 
same message by many different processors; so each may require its own logical 
Message ID Repository.<p>For further examples of this pattern in use you could 
look at the <a shape="rect" class="external-link" 
href="http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/IdempotentConsumerTest.java?view=markup";>junit
 test case</a></p><h3 id="IdempotentConsumer-SpringXMLexample">Spring XML 
example</h3><p>The following example will use the header 
<strong>myMessageId</strong> to filter out duplicates</p><div
  class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
-&lt;!-- repository for the idempotent consumer --&gt;
-&lt;bean id=&quot;myRepo&quot; 
class=&quot;org.apache.camel.processor.idempotent.MemoryIdempotentRepository&quot;/&gt;
-
-&lt;camelContext xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
-    &lt;route&gt;
-        &lt;from uri=&quot;direct:start&quot;/&gt;
-        &lt;idempotentConsumer messageIdRepositoryRef=&quot;myRepo&quot;&gt;
-            &lt;!-- use the messageId header as key for identifying duplicate 
messages --&gt;
-            &lt;header&gt;messageId&lt;/header&gt;
-            &lt;!-- if not a duplicate send it to this mock endpoint --&gt;
-            &lt;to uri=&quot;mock:result&quot;/&gt;
-        &lt;/idempotentConsumer&gt;
-    &lt;/route&gt;
-&lt;/camelContext&gt;
-]]></script>
-</div></div><h3 
id="IdempotentConsumer-Howtohandleduplicatemessagesintheroute">How to handle 
duplicate messages in the route</h3><p><strong>Available as of Camel 
2.8</strong></p><p>You can now set the <code>skipDuplicate</code> option to 
<code>false</code> which instructs the idempotent consumer to route duplicate 
messages as well. However the duplicate message has been marked as duplicate by 
having a property on the <a shape="rect" href="exchange.html">Exchange</a> set 
to true. We can leverage this fact by using a <a shape="rect" 
href="content-based-router.html">Content Based Router</a> or <a shape="rect" 
href="message-filter.html">Message Filter</a> to detect this and handle 
duplicate messages.</p><p>For example in the following example we use the <a 
shape="rect" href="message-filter.html">Message Filter</a> to send the message 
to a duplicate endpoint, and then stop continue routing that message.</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeHeader pane
 lHeader pdl" style="border-bottom-width: 1px;"><b>Filter duplicate 
messages</b></div><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
-from(&quot;direct:start&quot;)
-    // instruct idempotent consumer to not skip duplicates as we will filter 
then our self
-    
.idempotentConsumer(header(&quot;messageId&quot;)).messageIdRepository(repo).skipDuplicate(false)
-    .filter(property(Exchange.DUPLICATE_MESSAGE).isEqualTo(true))
-        // filter out duplicate messages by sending them to someplace else and 
then stop
-        .to(&quot;mock:duplicate&quot;)
-        .stop()
-    .end()
-    // and here we process only new messages (no duplicates)
-    .to(&quot;mock:result&quot;);
-]]></script>
-</div></div>The sample example in XML DSL would be:<div class="code panel pdl" 
style="border-width: 1px;"><div class="codeHeader panelHeader pdl" 
style="border-bottom-width: 1px;"><b>Filter duplicate messages</b></div><div 
class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
-
-&lt;!-- idempotent repository, just use a memory based for testing --&gt;
-&lt;bean id=&quot;myRepo&quot; 
class=&quot;org.apache.camel.processor.idempotent.MemoryIdempotentRepository&quot;/&gt;
-
-&lt;camelContext xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
-    &lt;route&gt;
-        &lt;from uri=&quot;direct:start&quot;/&gt;
-        &lt;!-- we do not want to skip any duplicate messages --&gt;
-        &lt;idempotentConsumer messageIdRepositoryRef=&quot;myRepo&quot; 
skipDuplicate=&quot;false&quot;&gt;
-            &lt;!-- use the messageId header as key for identifying duplicate 
messages --&gt;
-            &lt;header&gt;messageId&lt;/header&gt;
-            &lt;!-- we will to handle duplicate messages using a filter --&gt;
-            &lt;filter&gt;
-                &lt;!-- the filter will only react on duplicate messages, if 
this property is set on the Exchange --&gt;
-                
&lt;exchangeProperty&gt;CamelDuplicateMessage&lt;/exchangeProperty&gt;
-                &lt;!-- and send the message to this mock, due its part of an 
unit test --&gt;
-                &lt;!-- but you can of course do anything as its part of the 
route --&gt;
-                &lt;to uri=&quot;mock:duplicate&quot;/&gt;
-                &lt;!-- and then stop --&gt;
-                &lt;stop/&gt;
-            &lt;/filter&gt;
-            &lt;!-- here we route only new messages --&gt;
-            &lt;to uri=&quot;mock:result&quot;/&gt;
-        &lt;/idempotentConsumer&gt;
-    &lt;/route&gt;
-&lt;/camelContext&gt;
-]]></script>
-</div></div><h3 
id="IdempotentConsumer-Howtohandleduplicatemessageinaclusteredenvironmentwithadatagrid">How
 to handle duplicate message in a clustered environment with a data 
grid</h3><p><strong>Available as of Camel 2.8</strong></p><p>If you have 
running Camel in a clustered environment, a in memory idempotent repository 
doesn't work (see above). You can setup either a central database or use the 
idempotent consumer implementation based on the <a shape="rect" 
class="external-link" href="http://www.hazelcast.com/"; 
rel="nofollow">Hazelcast</a> data grid. Hazelcast finds the nodes over 
multicast (which is default - configure Hazelcast for tcp-ip) and creates 
automatically a map based repository:</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[  HazelcastIdempotentRepository 
idempotentRepo = new HazelcastIdempotentRepository(&quot;myrepo&quot;);
-
-  
from(&quot;direct:in&quot;).idempotentConsumer(header(&quot;messageId&quot;), 
idempotentRepo).to(&quot;mock:out&quot;);
-]]></script>
-</div></div><p>You have to define how long the repository should hold each 
message id (default is to delete it never). To avoid that you run out of memory 
you should create an eviction strategy based on the <a shape="rect" 
class="external-link" 
href="http://www.hazelcast.com/documentation.jsp#MapEviction"; 
rel="nofollow">Hazelcast configuration</a>. For additional information see <a 
shape="rect" href="hazelcast-component.html">camel-hazelcast</a>.</p><p>See 
this <a shape="rect" 
href="hazelcast-idempotent-repository-tutorial.html">little tutorial</a>, how 
setup such an idempotent repository on two cluster nodes using Apache 
Karaf.</p><p><strong>Available as of Camel <strong> 
2.13.0</strong></strong></p><p>Another option for using Idempotent Consumer in 
a clustered environment is Infinispan. Infinispan is a data grid with 
replication and distribution clustering support. For additional information 
see<strong> <a shape="rect" href="infinispan.html">camel-infinispan</a>.<br 
clear="none"><
 /strong></p><p></p><h4 id="IdempotentConsumer-UsingThisPattern">Using This 
Pattern</h4>
-
-<p>If you would like to use this EIP Pattern then please read the <a 
shape="rect" href="getting-started.html">Getting Started</a>, you may also find 
the <a shape="rect" href="architecture.html">Architecture</a> useful 
particularly the description of <a shape="rect" 
href="endpoint.html">Endpoint</a> and <a shape="rect" 
href="uris.html">URIs</a>. Then you could try out some of the <a shape="rect" 
href="examples.html">Examples</a> first before trying this pattern 
out.</p></div>
+  from("direct:in").idempotentConsumer(header("messageId"), 
idempotentRepo).to("mock:out");
+</plain-text-body><p>You have to define how long the repository should hold 
each message id (default is to delete it never). To avoid that you run out of 
memory you should create an eviction strategy based on the <a shape="rect" 
class="external-link" 
href="http://www.hazelcast.com/documentation.jsp#MapEviction"; 
rel="nofollow">Hazelcast configuration</a>. For additional information see <a 
shape="rect" href="hazelcast-component.html">camel-hazelcast</a>.</p><p>See 
this <a shape="rect" 
href="hazelcast-idempotent-repository-tutorial.html">little tutorial</a>, how 
setup such an idempotent repository on two cluster nodes using Apache 
Karaf.</p><p><strong>Available as of Camel <strong> 
2.13.0</strong></strong></p><p>Another option for using Idempotent Consumer in 
a clustered environment is Infinispan. Infinispan is a data grid with 
replication and distribution clustering support. For additional information 
see<strong> <a shape="rect" href="infinispan.html">camel-infinispan</a>.<br 
clear="n
 one"></strong></p><p><parameter ac:name=""><a shape="rect" 
href="using-this-pattern.html">Using This Pattern</a></parameter></p></div>
         </td>
         <td valign="top">
           <div class="navigation">


Reply via email to