Author: buildbot Date: Thu Aug 21 00:20:16 2014 New Revision: 919987 Log: Production update by buildbot for camel
Modified: websites/production/camel/content/book-in-one-page.html websites/production/camel/content/book-pattern-appendix.html websites/production/camel/content/cache/main.pageCache websites/production/camel/content/idempotent-consumer.html websites/production/camel/content/infinispan.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 Thu Aug 21 00:20:16 2014 @@ -4156,11 +4156,11 @@ While not actual tutorials you might fin </div> </div> <h2 id="BookInOnePage-Preface">Preface</h2><p>This tutorial aims to guide the reader through the stages of creating a project which uses Camel to facilitate the routing of messages from a JMS queue to a <a shape="rect" class="external-link" href="http://www.springramework.org" rel="nofollow">Spring</a> service. The route works in a synchronous fashion returning a response to the client.</p><p><style type="text/css">/*<![CDATA[*/ -div.rbtoc1408083432173 {padding: 0px;} -div.rbtoc1408083432173 ul {list-style: disc;margin-left: 0px;} -div.rbtoc1408083432173 li {margin-left: 0px;padding-left: 0px;} +div.rbtoc1408580348299 {padding: 0px;} +div.rbtoc1408580348299 ul {list-style: disc;margin-left: 0px;} +div.rbtoc1408580348299 li {margin-left: 0px;padding-left: 0px;} -/*]]>*/</style></p><div class="toc-macro rbtoc1408083432173"> +/*]]>*/</style></p><div class="toc-macro rbtoc1408580348299"> <ul class="toc-indentation"><li><a shape="rect" href="#Tutorial-JmsRemoting-TutorialonSpringRemotingwithJMS">Tutorial on Spring Remoting with JMS</a></li><li><a shape="rect" href="#Tutorial-JmsRemoting-Preface">Preface</a></li><li><a shape="rect" href="#Tutorial-JmsRemoting-Prerequisites">Prerequisites</a></li><li><a shape="rect" href="#Tutorial-JmsRemoting-Distribution">Distribution</a></li><li><a shape="rect" href="#Tutorial-JmsRemoting-About">About</a></li><li><a shape="rect" href="#Tutorial-JmsRemoting-CreatetheCamelProject">Create the Camel Project</a> <ul class="toc-indentation"><li><a shape="rect" href="#Tutorial-JmsRemoting-UpdatethePOMwithDependencies">Update the POM with Dependencies</a></li></ul> </li><li><a shape="rect" href="#Tutorial-JmsRemoting-WritingtheServer">Writing the Server</a> @@ -6346,11 +6346,11 @@ So we completed the last piece in the pi <style type="text/css">/*<![CDATA[*/ -div.rbtoc1408083432473 {padding: 0px;} -div.rbtoc1408083432473 ul {list-style: disc;margin-left: 0px;} -div.rbtoc1408083432473 li {margin-left: 0px;padding-left: 0px;} +div.rbtoc1408580348631 {padding: 0px;} +div.rbtoc1408580348631 ul {list-style: disc;margin-left: 0px;} +div.rbtoc1408580348631 li {margin-left: 0px;padding-left: 0px;} -/*]]>*/</style><div class="toc-macro rbtoc1408083432473"> +/*]]>*/</style><div class="toc-macro rbtoc1408580348631"> <ul class="toc-indentation"><li><a shape="rect" href="#Tutorial-AXIS-Camel-TutorialusingAxis1.4withApacheCamel">Tutorial using Axis 1.4 with Apache Camel</a> <ul class="toc-indentation"><li><a shape="rect" href="#Tutorial-AXIS-Camel-Prerequisites">Prerequisites</a></li><li><a shape="rect" href="#Tutorial-AXIS-Camel-Distribution">Distribution</a></li><li><a shape="rect" href="#Tutorial-AXIS-Camel-Introduction">Introduction</a></li><li><a shape="rect" href="#Tutorial-AXIS-Camel-SettinguptheprojecttorunAxis">Setting up the project to run Axis</a> <ul class="toc-indentation"><li><a shape="rect" href="#Tutorial-AXIS-Camel-Maven2">Maven 2</a></li><li><a shape="rect" href="#Tutorial-AXIS-Camel-wsdl">wsdl</a></li><li><a shape="rect" href="#Tutorial-AXIS-Camel-ConfiguringAxis">Configuring Axis</a></li><li><a shape="rect" href="#Tutorial-AXIS-Camel-RunningtheExample">Running the Example</a></li></ul> @@ -18053,32 +18053,7 @@ from("activemq:queue:Consumer.2.Vir <h4 id="BookInOnePage-UsingThisPattern.41">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> -<h3 id="BookInOnePage-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 has 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>)</li><li><a shape="rect" href="jpa.html">JpaMessageIdRepository</a></li></ul> - - -<h3 id="BookInOnePage-Options.20">Options</h3> -<p>The Idempotent Consumer has the following options:</p> - -<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 </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="confluenceTd"><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></tbody></table></div> - - -<h3 id="BookInOnePage-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"> +<h3 id="BookInOnePage-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 has 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>)</li><li><a shape="rect" href="jpa.html">JpaMe ssageIdRepository</a></li><li><p><a shape="rect" href="infinispan.html">InfinispanIdempotentRepository</a> (<strong>Available as of Camel 2.13.0)</strong></p></li></ul><h3 id="BookInOnePage-Options.20">Options</h3><p>The Idempotent Consumer has the following options:</p><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</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 de tect 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="confluenceTd"><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></tbody></table></div><h3 id="BookInOnePage-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="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[ RouteBuilder builder = new RouteBuilder() { public void configure() { @@ -18091,28 +18066,14 @@ RouteBuilder builder = new RouteBuilder( } }; ]]></script> -</div></div> - -<p>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</p> - -<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><p>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</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[ from("direct:start").idempotentConsumer( header("messageId"), jpaMessageIdRepository(lookup(JpaTemplate.class), PROCESSOR_NAME) ).to("mock:result"); ]]></script> -</div></div> - -<p>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="BookInOnePage-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"> +</div></div><p>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="BookInOnePage-SpringXMLexample">Spring XML example</h3><p>The following example will use the header <strong>myMessageId</strong> to filter out duplicates</p><d iv class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> <script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[ <!-- repository for the idempotent consumer --> <bean id="myRepo" class="org.apache.camel.processor.idempotent.MemoryIdempotentRepository"/> @@ -18129,17 +18090,7 @@ from("direct:start").idempoten </route> </camelContext> ]]></script> -</div></div> - - -<h3 id="BookInOnePage-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 panelHeader pdl" style="border-bottom-width: 1px;"><b>Filter duplicate messages</b></div><div class="codeContent panelContent pdl"> +</div></div><h3 id="BookInOnePage-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 panelHead er pdl" style="border-bottom-width: 1px;"><b>Filter duplicate messages</b></div><div class="codeContent panelContent pdl"> <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[ from("direct:start") // instruct idempotent consumer to not skip duplicates as we will filter then our self @@ -18152,11 +18103,7 @@ from("direct:start") // and here we process only new messages (no duplicates) .to("mock:result"); ]]></script> -</div></div> - -<p>The sample example in XML DSL would be:</p> - -<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"> +</div></div><p>The sample example in XML DSL would be:</p><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="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[ <!-- idempotent repository, just use a memory based for testing --> @@ -18185,27 +18132,12 @@ from("direct:start") </route> </camelContext> ]]></script> -</div></div> - - -<h3 id="BookInOnePage-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="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[ - HazelcastIdempotentRepository idempotentRepo = new HazelcastIdempotentRepository("myrepo"); +</div></div><h3 id="BookInOnePage-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="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[ HazelcastIdempotentRepository idempotentRepo = new HazelcastIdempotentRepository("myrepo"); from("direct:in").idempotentConsumer(header("messageId"), idempotentRepo).to("mock:out"); ]]></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> - -<h4 id="BookInOnePage-UsingThisPattern.42">Using This Pattern</h4> +</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="BookInOnePage-UsingThisPattern.42">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> <h3 id="BookInOnePage-TransactionalClient">Transactional Client</h3><p>Camel recommends supporting the <a shape="rect" class="external-link" href="http://www.enterpriseintegrationpatterns.com/TransactionalClient.html" rel="nofollow">Transactional Client</a> from the <a shape="rect" href="enterprise-integration-patterns.html">EIP patterns</a> using spring transactions.</p><p><img class="confluence-embedded-image confluence-external-resource" src="http://www.enterpriseintegrationpatterns.com/img/TransactionalClientSolution.gif" data-image-src="http://www.enterpriseintegrationpatterns.com/img/TransactionalClientSolution.gif"></p><p>Transaction Oriented Endpoints (<a shape="rect" href="what-is-a-camel-toe.html">Camel Toes</a>) like <a shape="rect" href="jms.html">JMS</a> support using a transaction for both inbound and outbound message exchanges. Endpoints that support transactions will participate in the current transaction context that they are called from.</p> <div class="aui-mess age success shadowed information-macro"> @@ -20138,11 +20070,11 @@ template.send("direct:alias-verify& </div> </div> <p>The <strong>cxf:</strong> component provides integration with <a shape="rect" href="http://cxf.apache.org">Apache CXF</a> for connecting to JAX-WS services hosted in CXF.</p><p><style type="text/css">/*<![CDATA[*/ -div.rbtoc1408083435384 {padding: 0px;} -div.rbtoc1408083435384 ul {list-style: disc;margin-left: 0px;} -div.rbtoc1408083435384 li {margin-left: 0px;padding-left: 0px;} +div.rbtoc1408580353495 {padding: 0px;} +div.rbtoc1408580353495 ul {list-style: disc;margin-left: 0px;} +div.rbtoc1408580353495 li {margin-left: 0px;padding-left: 0px;} -/*]]>*/</style></p><div class="toc-macro rbtoc1408083435384"> +/*]]>*/</style></p><div class="toc-macro rbtoc1408580353495"> <ul class="toc-indentation"><li><a shape="rect" href="#CXF-CXFComponent">CXF Component</a> <ul class="toc-indentation"><li><a shape="rect" href="#CXF-URIformat">URI format</a></li><li><a shape="rect" href="#CXF-Options">Options</a> <ul class="toc-indentation"><li><a shape="rect" href="#CXF-Thedescriptionsofthedataformats">The descriptions of the dataformats</a> Modified: websites/production/camel/content/book-pattern-appendix.html ============================================================================== --- websites/production/camel/content/book-pattern-appendix.html (original) +++ websites/production/camel/content/book-pattern-appendix.html Thu Aug 21 00:20:16 2014 @@ -4686,32 +4686,7 @@ from("activemq:queue:Consumer.2.Vir <h4 id="BookPatternAppendix-UsingThisPattern.41">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> -<h3 id="BookPatternAppendix-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 has 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>)</li><li><a shape="rect" href="jpa.html">JpaMessageIdRepository</a></li></ul> - - -<h3 id="BookPatternAppendix-Options.10">Options</h3> -<p>The Idempotent Consumer has the following options:</p> - -<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 </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="confluenceTd"><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></tbody></table></div> - - -<h3 id="BookPatternAppendix-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"> +<h3 id="BookPatternAppendix-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 has been seen before; if it has the me ssage 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>)</li><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></ul><h3 >id="BookPatternAppendix-Options.10">Options</h3><p>The Idempotent Consumer >has the following options:</p><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</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="confluenceTd"><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></tbody></table></div><h3 id="BookPatternAppendix-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="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[ RouteBuilder builder = new RouteBuilder() { public void configure() { @@ -4724,28 +4699,14 @@ RouteBuilder builder = new RouteBuilder( } }; ]]></script> -</div></div> - -<p>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</p> - -<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><p>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</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[ from("direct:start").idempotentConsumer( header("messageId"), jpaMessageIdRepository(lookup(JpaTemplate.class), PROCESSOR_NAME) ).to("mock:result"); ]]></script> -</div></div> - -<p>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="BookPatternAppendix-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"> +</div></div><p>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="BookPatternAppendix-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="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[ <!-- repository for the idempotent consumer --> <bean id="myRepo" class="org.apache.camel.processor.idempotent.MemoryIdempotentRepository"/> @@ -4762,17 +4723,7 @@ from("direct:start").idempoten </route> </camelContext> ]]></script> -</div></div> - - -<h3 id="BookPatternAppendix-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 panelHeader pdl" style="border-bottom-width: 1px;"><b>Filter duplicate messages</b></div><div class="codeContent panelContent pdl"> +</div></div><h3 id="BookPatternAppendix-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 pan elHeader pdl" style="border-bottom-width: 1px;"><b>Filter duplicate messages</b></div><div class="codeContent panelContent pdl"> <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[ from("direct:start") // instruct idempotent consumer to not skip duplicates as we will filter then our self @@ -4785,11 +4736,7 @@ from("direct:start") // and here we process only new messages (no duplicates) .to("mock:result"); ]]></script> -</div></div> - -<p>The sample example in XML DSL would be:</p> - -<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"> +</div></div><p>The sample example in XML DSL would be:</p><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="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[ <!-- idempotent repository, just use a memory based for testing --> @@ -4818,27 +4765,12 @@ from("direct:start") </route> </camelContext> ]]></script> -</div></div> - - -<h3 id="BookPatternAppendix-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="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[ - HazelcastIdempotentRepository idempotentRepo = new HazelcastIdempotentRepository("myrepo"); +</div></div><h3 id="BookPatternAppendix-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="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[ HazelcastIdempotentRepository idempotentRepo = new HazelcastIdempotentRepository("myrepo"); from("direct:in").idempotentConsumer(header("messageId"), idempotentRepo).to("mock:out"); ]]></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> - -<h4 id="BookPatternAppendix-UsingThisPattern.42">Using This Pattern</h4> +</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="BookPatternAppendix-UsingThisPattern.42">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> <h3 id="BookPatternAppendix-TransactionalClient">Transactional Client</h3><p>Camel recommends supporting the <a shape="rect" class="external-link" href="http://www.enterpriseintegrationpatterns.com/TransactionalClient.html" rel="nofollow">Transactional Client</a> from the <a shape="rect" href="enterprise-integration-patterns.html">EIP patterns</a> using spring transactions.</p><p><img class="confluence-embedded-image confluence-external-resource" src="http://www.enterpriseintegrationpatterns.com/img/TransactionalClientSolution.gif" data-image-src="http://www.enterpriseintegrationpatterns.com/img/TransactionalClientSolution.gif"></p><p>Transaction Oriented Endpoints (<a shape="rect" href="what-is-a-camel-toe.html">Camel Toes</a>) like <a shape="rect" href="jms.html">JMS</a> support using a transaction for both inbound and outbound message exchanges. Endpoints that support transactions will participate in the current transaction context that they are called from.</p> <div class="au i-message success shadowed information-macro"> Modified: websites/production/camel/content/cache/main.pageCache ============================================================================== Binary files - no diff available. Modified: websites/production/camel/content/idempotent-consumer.html ============================================================================== --- websites/production/camel/content/idempotent-consumer.html (original) +++ websites/production/camel/content/idempotent-consumer.html Thu Aug 21 00:20:16 2014 @@ -86,32 +86,7 @@ <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 has 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>)</li><li><a shape="rect" href="jpa.html">JpaMessageIdRepository</a></li></ul> - - -<h3 id="IdempotentConsumer-Options">Options</h3> -<p>The Idempotent Consumer has the following options:</p> - -<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 </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="confluenceTd"><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></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"> +<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></ul><h3 id="IdempotentConsumer-Options">Options</h3><p>The Idempotent Consumer has the following options:</p><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</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="confluenceTd"><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></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="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[ RouteBuilder builder = new RouteBuilder() { public void configure() { @@ -124,28 +99,14 @@ RouteBuilder builder = new RouteBuilder( } }; ]]></script> -</div></div> - -<p>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</p> - -<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><p>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</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[ from("direct:start").idempotentConsumer( header("messageId"), jpaMessageIdRepository(lookup(JpaTemplate.class), PROCESSOR_NAME) ).to("mock:result"); ]]></script> -</div></div> - -<p>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</p> - -<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><p>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< /p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> <script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[ <!-- repository for the idempotent consumer --> <bean id="myRepo" class="org.apache.camel.processor.idempotent.MemoryIdempotentRepository"/> @@ -162,17 +123,7 @@ from("direct:start").idempoten </route> </camelContext> ]]></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 panelHeader pdl" style="border-bottom-width: 1px;"><b>Filter duplicate messages</b></div><div class="codeContent panelContent pdl"> +</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="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[ from("direct:start") // instruct idempotent consumer to not skip duplicates as we will filter then our self @@ -185,11 +136,7 @@ from("direct:start") // and here we process only new messages (no duplicates) .to("mock:result"); ]]></script> -</div></div> - -<p>The sample example in XML DSL would be:</p> - -<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"> +</div></div><p>The sample example in XML DSL would be:</p><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="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[ <!-- idempotent repository, just use a memory based for testing --> @@ -218,27 +165,12 @@ from("direct:start") </route> </camelContext> ]]></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="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[ - HazelcastIdempotentRepository idempotentRepo = new HazelcastIdempotentRepository("myrepo"); +</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="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[ HazelcastIdempotentRepository idempotentRepo = new HazelcastIdempotentRepository("myrepo"); from("direct:in").idempotentConsumer(header("messageId"), idempotentRepo).to("mock:out"); ]]></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> - -<h4 id="IdempotentConsumer-UsingThisPattern">Using This Pattern</h4> +</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> </td> Modified: websites/production/camel/content/infinispan.html ============================================================================== --- websites/production/camel/content/infinispan.html (original) +++ websites/production/camel/content/infinispan.html Thu Aug 21 00:20:16 2014 @@ -102,6 +102,25 @@ .setHeader(InfinispanConstants.KEY, constant("123")) .to("infinispan://localhost?cacheContainer=#cacheContainer"); ]]></script> +</div></div><h3 id="Infinispan-UsingtheInfinispanbasedidempotentrepository">Using the Infinispan based idempotent repository</h3><p>In this section we will use the Infinispan based idempotent repository.</p><p>First, we need to create a cacheManager and then configure our</p><pre>org.apache.camel.component.infinispan.processor.idempotent.InfinispanIdempotentRepository:</pre><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[<bean id="cacheManager" class="org.infinispan.manager.DefaultCacheManager" init-method="start" destroy-method="stop"/> +<bean id="infinispanRepo" class="org.apache.camel.component.infinispan.processor.idempotent.InfinispanIdempotentRepository" + factory-method="infinispanIdempotentRepository"> + <argument ref="cacheManager"/> + <argument value="idempotent"/> +</bean> +]]></script> +</div></div><p>Then we can create our Infinispan idempotent repository in the spring XML file as well:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[<camelContext xmlns="http://camel.apache.org/schema/spring"> + <route id="JpaMessageIdRepositoryTest"> + <from uri="direct:start" /> + <idempotentConsumer messageIdRepositoryRef="infinispanStore"> + <header>messageId</header> + <to uri="mock:result" /> + </idempotentConsumer> + </route> +</camelContext> +]]></script> </div></div><p>For more information, see these resources...</p><p></p><h3 id="Infinispan-SeeAlso">See Also</h3> <ul><li><a shape="rect" href="configuring-camel.html">Configuring Camel</a></li><li><a shape="rect" href="component.html">Component</a></li><li><a shape="rect" href="endpoint.html">Endpoint</a></li><li><a shape="rect" href="getting-started.html">Getting Started</a></li></ul></div> </td>