camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Camel > Cometd
Date Mon, 29 Mar 2010 01:04:00 GMT
<html>
<head>
    <base href="http://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1519/1/1/_/styles/combined.css?spaceKey=CAMEL&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background-color: white" bgcolor="white">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
     <h2><a href="http://cwiki.apache.org/confluence/display/CAMEL/Cometd">Cometd</a></h2>
     <h4>Page <b>edited</b> by             <a href="http://cwiki.apache.org/confluence/display/~njiang">willem
jiang</a>
    </h4>
     
          <br/>
     <div class="notificationGreySide">
         <h2><a name="Cometd-CometdComponent"></a>Cometd Component</h2>

<p>The <b>cometd:</b> component is a transport for working with the <a
href="http://www.mortbay.org/jetty" rel="nofollow">jetty</a> implementation of the
<a href="http://docs.codehaus.org/display/JETTY/Cometd+%28aka+Bayeux%29" rel="nofollow">cometd/bayeux
protocol</a>.<br/>
Using this component in combination with the dojo toolkit library it's possible to push Camel
messages directly into the browser using an AJAX based mechanism.</p>

<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-java">
&lt;dependency&gt;
    &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
    &lt;artifactId&gt;camel-cometd&lt;/artifactId&gt;
    &lt;version&gt;x.x.x&lt;/version&gt;
    &lt;!-- use the same version as your Camel core version --&gt;
&lt;/dependency&gt;
</pre>
</div></div>

<h3><a name="Cometd-URIformat"></a>URI format</h3>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
cometd:<span class="code-comment">//host:port/channelName[?options]</span>
</pre>
</div></div>

<p>The <b>channelName</b> represents a topic that can be subscribed to by
the Camel endpoints.</p>

<h3><a name="Cometd-Examples"></a>Examples</h3>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>cometd://localhost:8080/service/mychannel
cometds://localhost:8443/service/mychannel
</pre>
</div></div>
<p>where <tt>cometds:</tt> represents an SSL configured endpoint.</p>

<p>See this <a href="http://www.davidgreco.it/MySite/Blog/Entries/2008/12/4_Camel,_Cometd_and_Bayeux_what_a_nice_combination.html"
rel="nofollow">blog entry</a> by David Greco who contributed this component to Apache
Camel, for a full sample. </p>

<h3><a name="Cometd-Options"></a>Options</h3>

<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Name         </th>
<th class='confluenceTh'> Default Value </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> <tt>resourceBase</tt>  </td>
<td class='confluenceTd'>&nbsp;</td>
<td class='confluenceTd'> The root directory for the web resources or classpath. Use
the protocol file: or classpath: depending if you want that the component loads the resource
from file system or classpath. Classpath is required for OSGI deployment where the resources
are packaged in the jar </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>timeout</tt> </td>
<td class='confluenceTd'> <tt>240000</tt> </td>
<td class='confluenceTd'> The server side poll timeout in milliseconds. This is how
long the server will hold a reconnect request before responding. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>interval</tt> </td>
<td class='confluenceTd'>      <tt>0</tt>          </td>
<td class='confluenceTd'> The client side poll timeout in milliseconds. How long a client
will wait between reconnects</td>
</tr>
<tr>
<td class='confluenceTd'> <tt>maxInterval</tt> </td>
<td class='confluenceTd'> <tt>30000</tt> </td>
<td class='confluenceTd'> The max client side poll timeout in milliseconds. A client
will be removed if a connection is not received in this time. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>multiFrameInterval</tt>   </td>
<td class='confluenceTd'> <tt>1500</tt> </td>
<td class='confluenceTd'> The client side poll timeout, if multiple connections are
detected from the same browser. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>jsonCommented</tt> </td>
<td class='confluenceTd'> <tt>true</tt> </td>
<td class='confluenceTd'>  If <tt>true</tt>, the server will accept JSON
wrapped in a comment and will generate JSON wrapped in a comment. This is a defence against
Ajax Hijacking. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>logLevel</tt> </td>
<td class='confluenceTd'> <tt>1</tt> </td>
<td class='confluenceTd'> <tt>0</tt>=none, <tt>1</tt>=info,
<tt>2</tt>=debug. </td>
</tr>
</tbody></table>

<p>You can append query options to the URI in the following format, <tt>?option=value&amp;option=value&amp;...</tt></p>

<p>Here is some examples on How to pass the parameters</p>

<p>For file (for webapp resources located in the Web Application directory --&gt;
cometd://localhost:8080?resourceBase=file./webapp<br/>
For classpath (when by example the web resources are packaged inside the webapp folder --&gt;
cometd://localhost:8080?resourceBase=classpath:webapp</p>

<h3><a name="Cometd-SeeAlso"></a>See Also</h3>
<ul>
	<li><a href="/confluence/display/CAMEL/Configuring+Camel" title="Configuring Camel">Configuring
Camel</a></li>
	<li><a href="/confluence/display/CAMEL/Component" title="Component">Component</a></li>
	<li><a href="/confluence/display/CAMEL/Endpoint" title="Endpoint">Endpoint</a></li>
	<li><a href="/confluence/display/CAMEL/Getting+Started" title="Getting Started">Getting
Started</a></li>
</ul>

     </div>
     <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;">
            <a href="http://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
       </div>

       <a href="http://cwiki.apache.org/confluence/display/CAMEL/Cometd">View Online</a>
       |
       <a href="http://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=103847&revisedVersion=8&originalVersion=7">View
Change</a>
              |
       <a href="http://cwiki.apache.org/confluence/display/CAMEL/Cometd?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message