Author: buildbot Date: Tue Jan 7 21:18:55 2014 New Revision: 893199 Log: Production update by buildbot for camel
Modified: websites/production/camel/content/cache/main.pageCache websites/production/camel/content/jgroups.html Modified: websites/production/camel/content/cache/main.pageCache ============================================================================== Binary files - no diff available. Modified: websites/production/camel/content/jgroups.html ============================================================================== --- websites/production/camel/content/jgroups.html (original) +++ websites/production/camel/content/jgroups.html Tue Jan 7 21:18:55 2014 @@ -111,7 +111,7 @@ </div></div><h3 id="JGroups-URIformat">URI format</h3><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[jgroups:clusterName[?options] ]]></script> -</div></div><p>Where <strong>clusterName</strong> represents the name of the JGroups cluster the component should connect to.</p><h3 id="JGroups-Options">Options</h3><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Default Value</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>channelProperties</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.10.0:</strong> Specifies configuration properties of the <a shape="rect" class="external-link" href="http://www.jgroups.org/javadoc/org/jgroups/JChannel.html" rel="nofollow">JChannel </a> used by the endpoint.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>enableViewMessages</code>< /td><td colspan="1" rowspan="1" class="confluenceTd"><code>false</code></td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.13.0</strong>:  Consumer only. If set to <code>true</code>, the consumer endpoint will receive <code>org.jgroups.View</code> messages as well (not only <code>org.jgroups.Message</code> instances). By default only regular messages are consumed by the endpoint.</td></tr></tbody></table></div><h3 id="JGroups-Headers">Headers</h3><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh">Header</th><th colspan="1" rowspan="1" class="confluenceTh">Constant</th><th colspan="1" rowspan="1" class="confluenceTh">Since version</th><th colspan="1" rowspan="1" class="confluenceTh">Description</th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>JGROUPS_ORIGINAL_MESSAGE</code></td><td colspan="1" rowspan="1" class="confluenceTd"><code>JGroupsEndpoint.HEADER_JGROUPS_ORIGINAL_MESSAGE< /code></td><td colspan="1" rowspan="1" class="confluenceTd"><strong>2.13.0</strong></td><td colspan="1" rowspan="1" class="confluenceTd">The original <code>org.jgroups.Message</code> instance from which the body of the consumed message has been extracted.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>JGROUPS_SRC</code></td><td colspan="1" rowspan="1" class="confluenceTd"><code><code>JGroupsEndpoint.</code>HEADER_JGROUPS_SRC</code></td><td colspan="1" rowspan="1" class="confluenceTd"><strong>2.10.0</strong></td><td colspan="1" rowspan="1" class="confluenceTd">The <code>org.jgroups.Address</code> instance extracted by <code>org.jgroups.Message</code>.getSrc() method of the consumed message.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>JGROUPS_DEST</code></td><td colspan="1" rowspan="1" class="confluenceTd"><code><code>JGroupsEndpoint.</code>HEADER_JGROUPS_DEST</code></td><td colspan="1" rowspan="1" class="confluenceTd"><strong>2.10.0</stron g></td><td colspan="1" rowspan="1" class="confluenceTd">The <code>org.jgroups.Address</code> instance extracted by <code>org.jgroups.Message</code>.getDest() method of the consumed message.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>JGROUPS_CHANNEL_ADDRESS</code></td><td colspan="1" rowspan="1" class="confluenceTd"><code><code>JGroupsEndpoint.</code>HEADER_JGROUPS_CHANNEL_ADDRESS</code></td><td colspan="1" rowspan="1" class="confluenceTd"><strong>2.13.0</strong></td><td colspan="1" rowspan="1" class="confluenceTd">Address (<code>org.jgroups.Address</code>) of the channel associated with the endpoint.</td></tr></tbody></table></div><p> </p><h3 id="JGroups-Usage">Usage</h3><p>Using <code>jgroups</code> component on the consumer side of the route will capture messages received by the <code>JChannel</code> associated with the endpoint and forward them to the Camel route. JGroups consumer processes incoming messages <a shape="rect" class="external-link" href ="http://camel.apache.org/asynchronous-routing-engine.html">asynchronously</a>.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><p>Where <strong>clusterName</strong> represents the name of the JGroups cluster the component should connect to.</p><h3 id="JGroups-Options">Options</h3><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Default Value</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>channelProperties</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.10.0:</strong> Specifies configuration properties of the <a shape="rect" class="external-link" href="http://www.jgroups.org/javadoc/org/jgroups/JChannel.html" rel="nofollow">JChannel </a> used by the endpoint.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>enableViewMessages</code>< /td><td colspan="1" rowspan="1" class="confluenceTd"><code>false</code></td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.13.0</strong>:  Consumer only. If set to <code>true</code>, the consumer endpoint will receive <code>org.jgroups.View</code> messages as well (not only <code>org.jgroups.Message</code> instances). By default only regular messages are consumed by the endpoint.</td></tr></tbody></table></div><h3 id="JGroups-Headers">Headers</h3><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh">Header</th><th colspan="1" rowspan="1" class="confluenceTh">Constant</th><th colspan="1" rowspan="1" class="confluenceTh">Since version</th><th colspan="1" rowspan="1" class="confluenceTh">Description</th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>JGROUPS_ORIGINAL_MESSAGE</code></td><td colspan="1" rowspan="1" class="confluenceTd"><code>JGroupsEndpoint.HEADER_JGROUPS_ORIGINAL_MESSAGE< /code></td><td colspan="1" rowspan="1" class="confluenceTd"><strong>2.13.0</strong></td><td colspan="1" rowspan="1" class="confluenceTd">The original <code>org.jgroups.Message</code> instance from which the body of the consumed message has been extracted.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>JGROUPS_SRC</code></td><td colspan="1" rowspan="1" class="confluenceTd"><code><code>JGroupsEndpoint.</code>HEADER_JGROUPS_SRC</code></td><td colspan="1" rowspan="1" class="confluenceTd"><strong>2.10.0</strong></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Consume</strong>r: The <code>org.jgroups.Address</code> instance extracted by <code>org.jgroups.Message</code>.getSrc() method of the consumed message.</p><p><strong>Producer</strong>: The custom source <code>org.jgroups.Address</code> of the message to be sent.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>JGROUPS_DEST</code></td><td colspan="1" rowspan="1" class="confl uenceTd"><code><code>JGroupsEndpoint.</code>HEADER_JGROUPS_DEST</code></td><td colspan="1" rowspan="1" class="confluenceTd"><strong>2.10.0</strong></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Consumer</strong>: The <code>org.jgroups.Address</code> instance extracted by <code>org.jgroups.Message</code>.getDest() method of the consumed message.</p><p><strong>Producer</strong>: The custom destination <code>org.jgroups.Address</code> of the message to be sent.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>JGROUPS_CHANNEL_ADDRESS</code></td><td colspan="1" rowspan="1" class="confluenceTd"><code><code>JGroupsEndpoint.</code>HEADER_JGROUPS_CHANNEL_ADDRESS</code></td><td colspan="1" rowspan="1" class="confluenceTd"><strong>2.13.0</strong></td><td colspan="1" rowspan="1" class="confluenceTd">Address (<code>org.jgroups.Address</code>) of the channel associated with the endpoint.</td></tr></tbody></table></div><p> </p><h3 id="JGroups-Usage">Us age</h3><p>Using <code>jgroups</code> component on the consumer side of the route will capture messages received by the <code>JChannel</code> associated with the endpoint and forward them to the Camel route. JGroups consumer processes incoming messages <a shape="rect" class="external-link" href="http://camel.apache.org/asynchronous-routing-engine.html">asynchronously</a>.</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[// Capture messages from cluster named // 'clusterName' and send them to Camel route. from("jgroups:clusterName").to("seda:queue"); @@ -127,11 +127,33 @@ from("jgroups:clusterName?enableVie filter(dropNonCoordinatorViews()). to("seda:masterNodeEventsQueue"); ]]></script> +</div></div><h3 id="JGroups-Predefinedexpressions">Predefined expressions</h3><p>JGroups component comes with predefined expressions factory class named <code>JGroupsExpressions.</code></p><p>If you would like to create <a shape="rect" href="delayer.html">delayer</a> that would affect the route only if the Camel context has not been started yet, use the <code>JGroupsExpressions.delayIfContextNotStarted(long delay)</code> factory method. The expression created by this factory method will return given delay value only if the Camel context is in the state different than <code>started</code>. This expression is particularly useful if you would like to use JGroups component for keeping singleton (master) route within the cluster. <a shape="rect" href="controlbus-component.html">Control Bus</a> <code>start</code> command won't initialize the singleton route if the Camel Context hasn't been yet started. So you need to delay a startup of the master route, to be sure that it has been initial ized after the Camel Context startup. Because such scenario can happen only during the initialization of the cluster, we don't want to delay startup of the slave node becoming the new master - that's why we need a conditional delay expression.</p><p>The snippet below demonstrates how to use conditional delaying with the JGroups component to delay the initial startup of master node in the cluster.</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[import static java.util.concurrent.TimeUnit.SECONDS; +import static org.apache.camel.component.jgroups.JGroupsExpressions.delayIfContextNotStarted; +import static org.apache.camel.component.jgroups.JGroupsFilters.dropNonCoordinatorViews; +... +from("jgroups:clusterName?enableViewMessages=true"). + filter(dropNonCoordinatorViews()). + threads().delay(delayIfContextNotStarted(SECONDS.toMillis(5))). // run in separated and delayed thread. Delay only if the context hasn't been started already. + Â to("controlbus:route?routeId=masterRoute&action=start&async=true"); + +from("timer://master?repeatCount=1").routeId("masterRoute").autoStartup(false).to(masterMockUri);Â ]]></script> </div></div><h3 id="JGroups-Examples">Examples</h3><h4 id="JGroups-Receiveclusterviewchangenotifications">Receive cluster view change notifications</h4><p>The snippet below demonstrates how to create the consumer endpoint listening to the notifications regarding cluster membership changes. By default only regular messages are consumed by the endpoint.</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[mockEndpoint.setExpectedMessageCount(1); mockEndpoint.message(0).body().isInstanceOf(org.jgroups.View.class); from("jgroups:clusterName?enableViewMessages=true").to(mockEndpoint); mockEndpoint.assertIsSatisfied();]]></script> +</div></div><h4 id="JGroups-Keepingsingletonroutewithinthecluster">Keeping singleton route within the cluster</h4><p>The snippet below demonstrates how to keep the singleton consumer route in the cluster of Camel Contexts. As soon as the master node dies, one of the slaves will be elected as a new master and started. In this particular example we want to keep singleton <a shape="rect" href="jetty.html">jetty</a> instance listening for the requests on address<code> <span class="nolink">http://localhost:8080/orders</span></code>.</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[import static java.util.concurrent.TimeUnit.SECONDS; +import static org.apache.camel.component.jgroups.JGroupsExpressions.delayIfContextNotStarted; +import static org.apache.camel.component.jgroups.JGroupsFilters.dropNonCoordinatorViews; +... +from("jgroups:clusterName?enableViewMessages=true"). + filter(dropNonCoordinatorViews()). + threads().delay(delayIfContextNotStarted(SECONDS.toMillis(5))). // run in separated and delayed thread. Delay only if the context hasn't been started already. + Â to("controlbus:route?routeId=masterRoute&action=start&async=true"); + +from("jetty:http://localhost:8080/orders").routeId("masterRoute").autoStartup(false).to("jms:orders");Â ]]></script> </div></div></div> </td> <td valign="top">