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 Tue, 26 Jul 2011 14:26:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/2042/9/1/_/styles/combined.css?spaceKey=CAMEL&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/CAMEL/Cometd">Cometd</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~davsclaus">Claus
Ibsen</a>
    </h4>
        <br/>
                         <h4>Changes (2)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >{div:class=confluenceTableSmall} <br>||
Name         || Default Value || Description || <br></td></tr>
            <tr><td class="diff-changed-lines" >| {{resourceBase}}  |        
        | 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. Notice this option has been renamed to {{baseResource}} from *Camel <span class="diff-changed-words">2.<span
class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">8</span><span
class="diff-added-chars"style="background-color: #dfd;">7</span>*</span> onwards.
| <br></td></tr>
            <tr><td class="diff-changed-lines" >| {{baseResource}} | | *Camel
<span class="diff-changed-words">2.<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">8</span><span
class="diff-added-chars"style="background-color: #dfd;">7</span>:*</span> 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 | <br></td></tr>
            <tr><td class="diff-unchanged" >| {{timeout}} | {{240000}} | The server
side poll timeout in milliseconds. This is how long the server will hold a reconnect request
before responding. | <br>| {{interval}} |      {{0}}          | The client side poll
timeout in milliseconds. How long a client will wait between reconnects| <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <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" class="external-link" rel="nofollow">jetty</a>
implementation of the <a href="http://docs.codehaus.org/display/JETTY/Cometd+%28aka+Bayeux%29"
class="external-link" 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-xml">
<span class="code-tag">&lt;dependency&gt;</span>
    <span class="code-tag">&lt;groupId&gt;</span>org.apache.camel<span
class="code-tag">&lt;/groupId&gt;</span>
    <span class="code-tag">&lt;artifactId&gt;</span>camel-cometd<span
class="code-tag">&lt;/artifactId&gt;</span>
    <span class="code-tag">&lt;version&gt;</span>x.x.x<span class="code-tag">&lt;/version&gt;</span>
    <span class="code-tag"><span class="code-comment">&lt;!-- use the same
version as your Camel core version --&gt;</span></span>
<span class="code-tag">&lt;/dependency&gt;</span>
</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"
class="external-link" 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>
<div class="confluenceTableSmall"><div class='table-wrap'>
<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. Notice this option has been renamed to <tt>baseResource</tt>
from <b>Camel 2.7</b> onwards. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>baseResource</tt> </td>
<td class='confluenceTd'>&nbsp;</td>
<td class='confluenceTd'> <b>Camel 2.7:</b> 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>
</div>
</div>

<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-Authentication"></a>Authentication</h3>
<p><b>Available as of Camel 2.8</b></p>

<p>You can configure custom <tt>SecurityPolicy</tt> and <tt>Extension</tt>'s
to the <tt>CometdComponent</tt> which allows you to use authentication as <a
href="http://cometd.org/documentation/howtos/authentication" class="external-link" rel="nofollow">documented
here</a></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="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/CAMEL/Cometd">View Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=103847&revisedVersion=12&originalVersion=11">View
Changes</a>
                |
        <a href="https://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