Author: buildbot Date: Thu May 24 10:18:02 2012 New Revision: 818935 Log: Production update by buildbot for camel
Modified: websites/production/camel/content/cache/main.pageCache websites/production/camel/content/jclouds.html websites/production/camel/content/websocket.html Modified: websites/production/camel/content/cache/main.pageCache ============================================================================== Binary files - no diff available. Modified: websites/production/camel/content/jclouds.html ============================================================================== --- websites/production/camel/content/jclouds.html (original) +++ websites/production/camel/content/jclouds.html Thu May 24 10:18:02 2012 @@ -76,9 +76,10 @@ <tr> <td valign="top" width="100%"> <div class="wiki-content maincontent"><h2><a shape="rect" name="jclouds-JcloudsComponent"></a>Jclouds Component</h2> + <p><b>Available as of Camel 2.9</b></p> -<p>This component allows interaction with cloud provider key-value engines (blobstores) and compute services. The component uses <a shape="rect" class="external-link" href="http://code.google.com/p/jclouds" rel="nofollow">jclouds</a> which is <br clear="none"> +<p>This component allows interaction with cloud provider key-value engines (blobstores) and compute services. The component uses <a shape="rect" class="external-link" href="http://code.google.com/p/jclouds" rel="nofollow">jclouds</a> which is<br clear="none"> a library that provides abstractions for blobstores and compute services.</p> <p><b>ComputeService</b> simplifies the task of managing machines in the cloud. For example, you can use ComputeService to start 5 machines and install your software on them.<br clear="none"> @@ -88,8 +89,7 @@ a library that provides abstractions for <p>Maven users will need to add the following dependency to their <tt>pom.xml</tt> for this component:</p> <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent"> -<pre class="code-xml"> -<span class="code-tag"><dependency></span> +<pre class="code-xml"><span class="code-tag"><dependency></span> <span class="code-tag"><groupId></span>org.apache.camel<span class="code-tag"></groupId></span> <span class="code-tag"><artifactId></span>camel-jclouds<span class="code-tag"></artifactId></span> <span class="code-tag"><version></span>x.x.x<span class="code-tag"></version></span> @@ -99,11 +99,11 @@ a library that provides abstractions for </div></div> <h3><a shape="rect" name="jclouds-Configuringthecomponent"></a>Configuring the component</h3> + <p>The camel jclouds component will make use of multiple jclouds blobstores and compute services as long as they are passed to the component during initialization. The component accepts a list blobstores and compute services. Here is how it can be configured.</p> <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent"> -<pre class="code-xml"> - <span class="code-tag"><bean id=<span class="code-quote">"jclouds"</span> class=<span class="code-quote">"org.apache.camel.component.jclouds.JcloudsComponent"</span>></span> +<pre class="code-xml"> <span class="code-tag"><bean id=<span class="code-quote">"jclouds"</span> class=<span class="code-quote">"org.apache.camel.component.jclouds.JcloudsComponent"</span>></span> <span class="code-tag"><property name=<span class="code-quote">"computeServices"</span>></span> <span class="code-tag"><list></span> <span class="code-tag"><ref bean=<span class="code-quote">"computeService"</span>/></span> @@ -125,7 +125,7 @@ a library that provides abstractions for <span class="code-tag"><constructor-arg name=<span class="code-quote">"credential"</span> value=<span class="code-quote">"CREDENTIAL"</span>/></span> <span class="code-tag"></bean></span> - <span class="code-tag"><bean id=<span class="code-quote">"blobStore"</span> factory-bean=<span class="code-quote">"blobStoreContext"</span> factory-method=<span class="code-quote">"getBlobStore"</span>/></span> + <span class="code-tag"><bean id=<span class="code-quote">"blobStore"</span> factory-bean=<span class="code-quote">"blobStoreContext"</span> factory-method=<span class="code-quote">"getBlobStore"</span>/></span> <span class="code-tag"><span class="code-comment"><!-- Creating a compute service from spring / blueprint xml --></span></span> <span class="code-tag"><bean id=<span class="code-quote">"computeServiceContextFactory"</span> class=<span class="code-quote">"org.jclouds.compute.ComputeServiceContextFactory"</span>/></span> @@ -148,8 +148,7 @@ a library that provides abstractions for <h3><a shape="rect" name="jclouds-URIformat"></a>URI format</h3> <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent"> -<pre class="code-java"> -jclouds:blobstore:[provider id][?options] +<pre class="code-java">jclouds:blobstore:[provider id][?options] jclouds:compute:[provider id][?options] </pre> </div></div> @@ -161,23 +160,23 @@ jclouds:compute:[provider id][?options] <h3><a shape="rect" name="jclouds-BlobstoreURIOptions"></a>Blobstore URI Options</h3> <div class="confluenceTableSmall"><div class="table-wrap"> -<table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"> Name </th><th colspan="1" rowspan="1" class="confluenceTh"> Default Value </th><th colspan="1" rowspan="1" class="confluenceTh"> Description </th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <tt>operation</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> PUT </td><td colspan="1" rowspan="1" class="confluenceTd"> <b>Producer Only</b>. Specifies the type of operation that will be performed to the blobstore. Allowed values are PUT, GET.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <tt>container</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> null </td><td colspan="1" rowspan="1" class="confluenceTd"> The name of the blob container.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <tt>blobName</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> null </td><td colspan="1" rowspan="1" class="confluenceTd"> The name o f the blob.</td></tr></tbody></table> +<table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"> Name </th><th colspan="1" rowspan="1" class="confluenceTh"> Default Value </th><th colspan="1" rowspan="1" class="confluenceTh"> Description </th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <tt>operation</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> PUT </td><td colspan="1" rowspan="1" class="confluenceTd"> <b>Producer Only</b>. Specifies the type of operation that will be performed to the blobstore. Allowed values are PUT, GET. </td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <tt>container</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> null </td><td colspan="1" rowspan="1" class="confluenceTd"> The name of the blob container. </td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <tt>blobName</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> null </td><td colspan="1" rowspan="1" class="confluenceTd"> The name of the blob. </td></tr></tbody></table> </div> </div> <p>You can have as many of these options as you like.</p> <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent"> -<pre class="code-java"> -jclouds:blobstore:aws-s3?operation=CamelJcloudsGet&container=mycontainer&blobName=someblob +<pre class="code-java">jclouds:blobstore:aws-s3?operation=CamelJcloudsGet&container=mycontainer&blobName=someblob </pre> </div></div> <p>For producer endpoint you can override all of the above URI options by passing the appropriate headers to the message.</p> + <h4><a shape="rect" name="jclouds-MessageHeadersforblobstore"></a>Message Headers for blobstore</h4> <div class="confluenceTableSmall"><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"> Description </th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <tt>CamelJcloudsOperation</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> The operation to be performed on the blob. The valid options are <ul class="alternate" type="square"><li>PUT</li><li>GET</li></ul> -</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <tt>CamelJcloudsContainer</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> The name of the blob container.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <tt>CamelJcloudsBlobName</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> The name of the blob.</td></tr></tbody></table> +</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <tt>CamelJcloudsContainer</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> The name of the blob container. </td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <tt>CamelJcloudsBlobName</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> The name of the blob. </td></tr></tbody></table> </div> </div> @@ -187,8 +186,7 @@ jclouds:blobstore:aws-s3?operation=Camel <p>This example will show you how you can store any message inside a blob using the jclouds component.</p> <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent"> -<pre class="code-java"> -from(<span class="code-quote">"direct:start"</span>) +<pre class="code-java">from(<span class="code-quote">"direct:start"</span>) .to(<span class="code-quote">"jclouds:blobstore:aws-s3"</span> + <span class="code-quote">"?operation=PUT"</span> + <span class="code-quote">"&container=mycontainer"</span> + @@ -200,8 +198,7 @@ from(<span class="code-quote">"direct:st Here is how the above example would look like using xml to define our route.</p> <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent"> -<pre class="code-xml"> -<span class="code-tag"><route></span> +<pre class="code-xml"><span class="code-tag"><route></span> <span class="code-tag"><from uri=<span class="code-quote">"direct:start"</span>/></span> <span class="code-tag"><to uri=<span class="code-quote">"jclouds:blobstore:aws-s3?operation=PUT&container=mycontainer&blobName=myblob"</span>/></span> <span class="code-tag"></route></span> @@ -212,8 +209,7 @@ Here is how the above example would look <p>This example will show you how you can read the contnet of a blob using the jclouds component.</p> <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent"> -<pre class="code-java"> -from(<span class="code-quote">"direct:start"</span>) +<pre class="code-java">from(<span class="code-quote">"direct:start"</span>) .to(<span class="code-quote">"jclouds:blobstore:aws-s3"</span> + <span class="code-quote">"?operation=GET"</span> + <span class="code-quote">"&container=mycontainer"</span> + @@ -225,8 +221,7 @@ from(<span class="code-quote">"direct:st Here is how the above example would look like using xml to define our route.</p> <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent"> -<pre class="code-xml"> -<span class="code-tag"><route></span> +<pre class="code-xml"><span class="code-tag"><route></span> <span class="code-tag"><from uri=<span class="code-quote">"direct:start"</span>/></span> <span class="code-tag"><to uri=<span class="code-quote">"jclouds:blobstore:aws-s3?operation=PUT&container=mycontainer&blobName=myblob"</span>/></span> <span class="code-tag"></route></span> @@ -235,11 +230,11 @@ Here is how the above example would look <h4><a shape="rect" name="jclouds-Example3%3AConsumingablob"></a>Example 3: Consuming a blob</h4> + <p>This example will consume all blob that are under the specified container. The generated exchange will contain the payload of the blob as body.</p> <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent"> -<pre class="code-java"> - from(<span class="code-quote">"jclouds:blobstore:aws-s3"</span> + - <span class="code-quote">"&container=mycontainer"</span>) +<pre class="code-java"> from(<span class="code-quote">"jclouds:blobstore:aws-s3"</span> + + <span class="code-quote">"?container=mycontainer"</span>) .to(<span class="code-quote">"direct:next"</span>); </pre> </div></div> @@ -247,9 +242,8 @@ Here is how the above example would look <p>You can achieve the same goal by using xml, as you can see below.</p> <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent"> -<pre class="code-xml"> -<span class="code-tag"><route></span> - <span class="code-tag"><from uri=<span class="code-quote">"jclouds:blobstore:aws-s3?operation=PUT&container=mycontainer&blobName=myblob"</span>/></span> +<pre class="code-xml"><span class="code-tag"><route></span> + <span class="code-tag"><from uri=<span class="code-quote">"jclouds:blobstore:aws-s3?operation=GET&container=mycontainer&blobName=myblob"</span>/></span> <span class="code-tag"><to uri=<span class="code-quote">"direct:next"</span>/></span> <span class="code-tag"></route></span> </pre> @@ -258,16 +252,14 @@ Here is how the above example would look <h3><a shape="rect" name="jclouds-ComputeServiceURIOptions"></a>Compute Service URI Options</h3> <div class="confluenceTableSmall"><div class="table-wrap"> -<table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"> Name </th><th colspan="1" rowspan="1" class="confluenceTh"> Default Value </th><th colspan="1" rowspan="1" class="confluenceTh"> Description </th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <tt>operation</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> PUT </td><td colspan="1" rowspan="1" class="confluenceTd"> Specifies the type of operation that will be performed to the compute service. Allowed values are CREATE_NODE, RUNS_CRIPT, DESTROY_NODE, LIST_NODES, LIST_IMAGES, LIST_HARDWARE.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <tt>imageId</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> null </td><td colspan="1" rowspan="1" class="confluenceTd"> <b>CREATE_NODE operation only</b> The imageId that will be used for creating a node. Values depend on the actual cloud provider. </td></tr><tr><td colspan="1" rowspan="1" class="confluenc eTd"> <tt>locationId</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> null </td><td colspan="1" rowspan="1" class="confluenceTd"> <b>CREATE_NODE operation only</b> The location that will be used for creating a node. Values depend on the actual cloud provider.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <tt>hardwareId</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> null </td><td colspan="1" rowspan="1" class="confluenceTd"> <b>CREATE_NODE operation only</b> The hardware that will be used for creating a node. Values depend on the actual cloud provider.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <tt>group</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> null </td><td colspan="1" rowspan="1" class="confluenceTd"> <b>CREATE_NODE operation only</b> The group that will be assigned to the newly created node. Values depend on the actual cloud provider.</td></tr><tr><td colspan="1" rowspan="1" class="confluenc eTd"> <tt>nodeId</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> null </td><td colspan="1" rowspan="1" class="confluenceTd"> <b>RUN_SCRIPT & DESTROY_NODE operation only</b> The id of the node that will run the script or destroyed.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <tt>user</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> null </td><td colspan="1" rowspan="1" class="confluenceTd"> <b>RUN_SCRIPT operation only</b> The user on the target node that will run the script.</td></tr></tbody></table> +<table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"> Name </th><th colspan="1" rowspan="1" class="confluenceTh"> Default Value </th><th colspan="1" rowspan="1" class="confluenceTh"> Description </th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <tt>operation</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> PUT </td><td colspan="1" rowspan="1" class="confluenceTd"> Specifies the type of operation that will be performed to the compute service. Allowed values are CREATE_NODE, RUNS_CRIPT, DESTROY_NODE, LIST_NODES, LIST_IMAGES, LIST_HARDWARE. </td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <tt>imageId</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> null </td><td colspan="1" rowspan="1" class="confluenceTd"> <b>CREATE_NODE operation only</b> The imageId that will be used for creating a node. Values depend on the actual cloud provider. </td></tr><tr><td colspan="1" rowspan="1" class="confluen ceTd"> <tt>locationId</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> null </td><td colspan="1" rowspan="1" class="confluenceTd"> <b>CREATE_NODE operation only</b> The location that will be used for creating a node. Values depend on the actual cloud provider. </td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <tt>hardwareId</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> null </td><td colspan="1" rowspan="1" class="confluenceTd"> <b>CREATE_NODE operation only</b> The hardware that will be used for creating a node. Values depend on the actual cloud provider. </td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <tt>group</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> null </td><td colspan="1" rowspan="1" class="confluenceTd"> <b>CREATE_NODE operation only</b> The group that will be assigned to the newly created node. Values depend on the actual cloud provider. </td></tr><tr><td colspan="1" rowspan="1" class="confluen ceTd"> <tt>nodeId</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> null </td><td colspan="1" rowspan="1" class="confluenceTd"> <b>RUN_SCRIPT & DESTROY_NODE operation only</b> The id of the node that will run the script or destroyed. </td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <tt>user</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> null </td><td colspan="1" rowspan="1" class="confluenceTd"> <b>RUN_SCRIPT operation only</b> The user on the target node that will run the script. </td></tr></tbody></table> </div> - </div> <p>The combination of parameters for use with the compute service depend on the operation.</p> <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent"> -<pre class="code-java"> -jclouds:compute:aws-ec2?operation=CREATE_NODE&imageId=AMI_XXXXX&locationId=eu-west-1&group=mygroup +<pre class="code-java">jclouds:compute:aws-ec2?operation=CREATE_NODE&imageId=AMI_XXXXX&locationId=eu-west-1&group=mygroup </pre> </div></div> @@ -277,8 +269,7 @@ jclouds:compute:aws-ec2?operation=CREATE <h4><a shape="rect" name="jclouds-Example1%3AListingtheavailableimages."></a>Example 1: Listing the available images.</h4> <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent"> -<pre class="code-java"> - from(<span class="code-quote">"jclouds:compute:aws-ec2"</span> + +<pre class="code-java"> from(<span class="code-quote">"jclouds:compute:aws-ec2"</span> + <span class="code-quote">"&operation=LIST_IMAGES"</span>) .to(<span class="code-quote">"direct:next"</span>); </pre> @@ -287,8 +278,7 @@ jclouds:compute:aws-ec2?operation=CREATE <p>This will create a message that will contain the list of images inside its body. You can also do the same using xml.</p> <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent"> -<pre class="code-xml"> -<span class="code-tag"><route></span> +<pre class="code-xml"><span class="code-tag"><route></span> <span class="code-tag"><from uri=<span class="code-quote">"jclouds:compute:aws-ec2?operation=LIST_IMAGES"</span>/></span> <span class="code-tag"><to uri=<span class="code-quote">"direct:next"</span>/></span> <span class="code-tag"></route></span> @@ -297,21 +287,19 @@ jclouds:compute:aws-ec2?operation=CREATE <h4><a shape="rect" name="jclouds-Example2%3ACreateanewnode."></a>Example 2: Create a new node.</h4> <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent"> -<pre class="code-java"> - from(<span class="code-quote">"direct:start"</span>). +<pre class="code-java"> from(<span class="code-quote">"direct:start"</span>). to(<span class="code-quote">"jclouds:compute:aws-ec2"</span> + <span class="code-quote">"?operation=CREATE_NODE"</span> + <span class="code-quote">"&imageId=AMI_XXXXX"</span> + <span class="code-quote">"&locationId=XXXXX"</span> + - <span class="code-quote">"&group=myGroup"</span>); + <span class="code-quote">"&group=myGroup"</span>); </pre> </div></div> <p>This will create a new node on the cloud provider. The out message in this case will be a set of metadata that contains information about the newly created node (e.g. the ip, hostname etc). Here is the same using spring xml.</p> <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent"> -<pre class="code-xml"> -<span class="code-tag"><route></span> +<pre class="code-xml"><span class="code-tag"><route></span> <span class="code-tag"><from uri=<span class="code-quote">"direct:start"</span>/></span> <span class="code-tag"><to uri=<span class="code-quote">"jclouds:compute:aws-ec2?operation=CREATE_NODE&imageId=AMI_XXXXX&locationId=XXXXX&group=myGroup"</span>/></span> <span class="code-tag"></route></span> @@ -320,12 +308,11 @@ jclouds:compute:aws-ec2?operation=CREATE <h4><a shape="rect" name="jclouds-Example3%3ARunashellscriptonrunningnode."></a>Example 3: Run a shell script on running node.</h4> <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent"> -<pre class="code-java"> - from(<span class="code-quote">"direct:start"</span>). +<pre class="code-java"> from(<span class="code-quote">"direct:start"</span>). to(<span class="code-quote">"jclouds:compute:aws-ec2"</span> + <span class="code-quote">"?operation=RUN_SCRIPT"</span> + <span class="code-quote">"?nodeId=10"</span> + - <span class="code-quote">"&user=ubuntu"</span>); + <span class="code-quote">"&user=ubuntu"</span>); </pre> </div></div> @@ -336,8 +323,7 @@ jclouds:compute:aws-ec2?operation=CREATE <p>Here is the same using spring xml.</p> <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent"> -<pre class="code-xml"> -<span class="code-tag"><route></span> +<pre class="code-xml"><span class="code-tag"><route></span> <span class="code-tag"><from uri=<span class="code-quote">"direct:start"</span>/></span> <span class="code-tag"><to uri=<span class="code-quote">"jclouds:compute:aws-ec2?operation=RUN_SCRIPT&?nodeId=10&user=ubuntu"</span>/></span> <span class="code-tag"></route></span> @@ -345,10 +331,10 @@ jclouds:compute:aws-ec2?operation=CREATE </div></div> <h4><a shape="rect" name="jclouds-Seealso"></a>See also</h4> + <p>If you want to find out more about jclouds here is list of interesting resources<br clear="none"> <a shape="rect" class="external-link" href="http://code.google.com/p/jclouds/wiki/BlobStore" rel="nofollow">Jclouds Blobstore wiki</a><br clear="none"> -<a shape="rect" class="external-link" href="http://code.google.com/p/jclouds/wiki/ComputeGuide" rel="nofollow">Jclouds Compute wiki</a></p> -</div> +<a shape="rect" class="external-link" href="http://code.google.com/p/jclouds/wiki/ComputeGuide" rel="nofollow">Jclouds Compute wiki</a></p></div> </td> <td valign="top"> <div class="navigation"> Modified: websites/production/camel/content/websocket.html ============================================================================== --- websites/production/camel/content/websocket.html (original) +++ websites/production/camel/content/websocket.html Thu May 24 10:18:02 2012 @@ -78,7 +78,7 @@ <div class="wiki-content maincontent"><h2><a shape="rect" name="Websocket-WebsocketComponent"></a>Websocket Component</h2> <p><b>Available as of Camel 2.10</b></p> -<p>The <b>websocket</b> component provides websocket <a shape="rect" href="endpoint.html" title="Endpoint">endpoints</a> for communicating with clients using websocket. The component uses Eclipse Jetty Server which implements the <a shape="rect" class="external-link" href="http://tools.ietf.org/html/rfc6455" rel="nofollow">IETF</a> specification (drafts and RFC 6455).</p> +<p>The <b>websocket</b> component provides websocket <a shape="rect" href="endpoint.html" title="Endpoint">endpoints</a> for communicating with clients using websocket. The component uses Eclipse Jetty Server which implements the <a shape="rect" class="external-link" href="http://tools.ietf.org/html/rfc6455" rel="nofollow">IETF</a> specification (drafts and RFC 6455). It supports the protocols ws:// and wss://. To use wss:// protocol, the SSLContextParameters must be defined.</p> <div class="panelMacro"><table class="infoMacro"><colgroup span="1"><col span="1" width="24"><col span="1"></colgroup><tr><td colspan="1" rowspan="1" valign="top"><img align="middle" src="https://cwiki.apache.org/confluence/images/icons/emoticons/information.gif" width="16" height="16" alt="" border="0"></td><td colspan="1" rowspan="1"><b>Version currently supported</b><br clear="none">As Camel 2.10 uses Jetty 7.5.4.v20111024, only the D00 to <a shape="rect" class="external-link" href="http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-13" rel="nofollow">D13</a> IETF implementations are available.</td></tr></table></div> @@ -94,7 +94,16 @@ websocket:<span class="code-comment">//h <h3><a shape="rect" name="Websocket-Options"></a>Options</h3> -<p>None.</p> +<div class="confluenceTableSmall"><div class="table-wrap"> +<table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"> Name </th><th colspan="1" rowspan="1" class="confluenceTh"> Default Value </th><th colspan="1" rowspan="1" class="confluenceTh"> Description </th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> sslContextParameters </td><td colspan="1" rowspan="1" class="confluenceTd"> </td><td colspan="1" rowspan="1" class="confluenceTd"> Reference to a <tt>org.apache.camel.util.jsse.SSLContextParameters</tt> in the <a shape="rect" class="external-link" href="http://camel.apache.org/registry.html">Registry</a>.  This reference overrides any configured SSLContextParameters at the component level.  See <a shape="rect" href="camel-configuration-utilities.html" title="Camel Configuration Utilities">Using the JSSE Configuration Utility</a>. <br clear="none" class="atl-forced-newline"> </td></tr></tbody></table> +</div> +</div> + +<p>You can append query options to the URI in the following format, <tt>?option=value&option=value&...</tt></p> + +<p>Here is some examples on How to pass the parameters</p> + +<p>To use ssl and websocket secure --> websocket://localhost:8443?/test?sslContextParametersRef=#sslContextParameters</p> <h3><a shape="rect" name="Websocket-MessageHeaders"></a>Message Headers</h3> @@ -143,6 +152,81 @@ because by default the messaging is InOn <p>This example is part of an unit test, which you can find <a shape="rect" class="external-link" href="https://svn.apache.org/repos/asf/camel/trunk/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketRouteExampleTest.java">here</a>. As a client we use the <a shape="rect" href="ahc.html" title="AHC">AHC</a> library which offers support for web socket as well. </p> +<h3><a shape="rect" name="Websocket-SettingupSSLforWebSocketComponent"></a>Setting up SSL for WebSocket Component</h3> + +<h4><a shape="rect" name="Websocket-UsingtheJSSEConfigurationUtility"></a>Using the JSSE Configuration Utility</h4> + +<p>As of Camel 2.10, the WebSocket component supports SSL/TLS configuration through the <a shape="rect" href="camel-configuration-utilities.html" title="Camel Configuration Utilities">Camel JSSE Configuration Utility</a>.  This utility greatly decreases the amount of component specific code you need to write and is configurable at the endpoint and component levels.  The following examples demonstrate how to use the utility with the Cometd component.</p> + +<h5><a shape="rect" name="Websocket-Programmaticconfigurationofthecomponent"></a>Programmatic configuration of the component</h5> + +<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent"> +<pre class="code-java"> +KeyStoreParameters ksp = <span class="code-keyword">new</span> KeyStoreParameters(); +ksp.setResource(<span class="code-quote">"/users/home/server/keystore.jks"</span>); +ksp.setPassword(<span class="code-quote">"keystorePassword"</span>); + +KeyManagersParameters kmp = <span class="code-keyword">new</span> KeyManagersParameters(); +kmp.setKeyStore(ksp); +kmp.setKeyPassword(<span class="code-quote">"keyPassword"</span>); + +TrustManagersParameters tmp = <span class="code-keyword">new</span> TrustManagersParameters(); +tmp.setKeyStore(ksp); + +SSLContextParameters scp = <span class="code-keyword">new</span> SSLContextParameters(); +scp.setKeyManagers(kmp); +scp.setTrustManagers(tmp); + +CometdComponent commetdComponent = getContext().getComponent(<span class="code-quote">"cometds"</span>, CometdComponent.class); +commetdComponent.setSslContextParameters(scp); +</pre> +</div></div> + +<h5><a shape="rect" name="Websocket-SpringDSLbasedconfigurationofendpoint"></a>Spring DSL based configuration of endpoint</h5> + +<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent"> +<pre class="code-xml"> +... + <camel:sslContextParameters + id=<span class="code-quote">"sslContextParameters"</span>> + <camel:keyManagers + keyPassword=<span class="code-quote">"keyPassword"</span>> + <camel:keyStore + resource=<span class="code-quote">"/users/home/server/keystore.jks"</span> + password=<span class="code-quote">"keystorePassword"</span>/> + <span class="code-tag"></camel:keyManagers></span> + <span class="code-tag"><camel:trustManagers></span> + <camel:keyStore + resource=<span class="code-quote">"/users/home/server/keystore.jks"</span> + password=<span class="code-quote">"keystorePassword"</span>/> + <span class="code-tag"></camel:keyManagers></span> + <span class="code-tag"></camel:sslContextParameters></span>... +... + <span class="code-tag"><to uri=<span class="code-quote">"websocket://127.0.0.1:8443/test?sslContextParameters=#sslContextParameters"</span>/></span>... +</pre> +</div></div> + +<h5><a shape="rect" name="Websocket-JavaDSLbasedconfigurationofendpoint"></a>Java DSL based configuration of endpoint</h5> + +<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent"> +<pre class="code-java"> +... + <span class="code-keyword">protected</span> RouteBuilder createRouteBuilder() <span class="code-keyword">throws</span> Exception { + <span class="code-keyword">return</span> <span class="code-keyword">new</span> RouteBuilder() { + <span class="code-keyword">public</span> void configure() { + + <span class="code-object">String</span> uri = <span class="code-quote">"websocket:<span class="code-comment">//127.0.0.1:8443/test?sslContextParametersRef=#sslContextParameters"</span>; +</span> + from(uri) + .log(<span class="code-quote">">>> Message received from WebSocket Client : ${body}"</span>) + .to(<span class="code-quote">"mock:client"</span>) + .loop(10) + .setBody().constant(<span class="code-quote">">> Welcome on board!"</span>) + .to(uri); +... +</pre> +</div></div> + <h3><a shape="rect" name="Websocket-SeeAlso"></a>See Also</h3> <ul><li><a shape="rect" href="configuring-camel.html" title="Configuring Camel">Configuring Camel</a></li><li><a shape="rect" href="component.html" title="Component">Component</a></li><li><a shape="rect" href="endpoint.html" title="Endpoint">Endpoint</a></li><li><a shape="rect" href="getting-started.html" title="Getting Started">Getting Started</a></li></ul>