camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Liguori (Confluence)" <conflue...@apache.org>
Subject [CONF] Apache Camel > gtask
Date Wed, 11 Sep 2013 01:24:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/en/2176/1/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/gtask">gtask</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~gliesian">Robert
Liguori</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" > <br>{code} <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">gtask://queue-name
<br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">gtask://queue-name[?options]
<br></td></tr>
            <tr><td class="diff-unchanged" >{code} <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h2><a name="gtask-%7B%7Bgtask%7D%7DComponent"></a><tt>gtask</tt>
Component</h2>

<p><b>Available as of Camel 2.1</b><br/>
The <tt>gtask</tt> component contributes to the <a href="/confluence/display/CAMEL/GAE"
title="GAE">Camel Components for Google App Engine</a> (GAE). It supports asynchronous
message processing on GAE by using the <a href="http://code.google.com/appengine/docs/java/taskqueue/"
class="external-link" rel="nofollow">task queueing service</a> as message queue.
For adding messages to a queue it uses the task queue API. For receiving messages from a queue
it installs an HTTP callback handler. The handler is called by an HTTP POST callback (a <a
href="http://www.webhooks.org/" class="external-link" rel="nofollow">web hook</a>)
initiated by the task queueing service. Whenever a new task is added to a queue a callback
will be sent. The <tt>gtask</tt> component abstracts from these details and supports
endpoint URIs that make message queueing on GAE as easy as message queueing with <a href="/confluence/display/CAMEL/JMS"
title="JMS">JMS</a> or <a href="/confluence/display/CAMEL/SEDA" title="SEDA">SEDA</a>.</p>

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

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Default; brush: java; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
gtask://queue-name[?options]
</pre>
</div></div>

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

<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Name </th>
<th class='confluenceTh'> Default Value </th>
<th class='confluenceTh'> Context </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> <tt>workerRoot</tt> </td>
<td class='confluenceTd'> <tt>worker</tt> </td>
<td class='confluenceTd'> Producer </td>
<td class='confluenceTd'> The servlet mapping for callback handlers. By default, this
component requires a callback servlet mapping of <tt>/worker/&#42;</tt>. If
another servlet mapping is used e.g. <tt>/myworker/&#42;</tt> it must be set
as option on the producer side: <tt>to("gtask:myqueue?workerRoot=myworker")</tt>.</td>
</tr>
<tr>
<td class='confluenceTd'> <tt>inboundBindingRef</tt> </td>
<td class='confluenceTd'> reference to <tt>GTaskBinding</tt> </td>
<td class='confluenceTd'> Consumer </td>
<td class='confluenceTd'>Reference to an <tt>InboundBinding&lt;GTaskEndpoint,
HttpServletRequest, HttpServletResponse&gt;</tt> in the <a href="/confluence/display/CAMEL/Registry"
title="Registry">Registry</a> for customizing the binding of an <tt>Exchange</tt>
to the Servlet API. The referenced binding is used as post-processor to <tt>org.apache.camel.component.http.HttpBinding</tt>.</td>
</tr>
<tr>
<td class='confluenceTd'> <tt>outboundBindingRef</tt> </td>
<td class='confluenceTd'> reference to <tt>GTaskBinding</tt> </td>
<td class='confluenceTd'> Producer </td>
<td class='confluenceTd'>Reference to an <tt>OutboundBinding&lt;GTaskEndpoint,
TaskOptions, void&gt;</tt> in the <a href="/confluence/display/CAMEL/Registry"
title="Registry">Registry</a> for customizing the binding of an <tt>Exchange</tt>
to the task queueing service.</td>
</tr>
</tbody></table>
</div>


<p>On the consumer-side, all options of the <a href="/confluence/display/CAMEL/SERVLET"
title="SERVLET">Servlet component</a> are supported.</p>

<h3><a name="gtask-Messageheaders"></a>Message headers</h3>

<p>On the consumer-side all headers of the <a href="/confluence/display/CAMEL/SERVLET"
title="SERVLET">Servlet component</a> component are supported plus the following.</p>

<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Name </th>
<th class='confluenceTh'> Type </th>
<th class='confluenceTh'> Context </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> <tt>GTaskBinding.GTASK_QUEUE_NAME</tt> </td>
<td class='confluenceTd'> <tt>String</tt> </td>
<td class='confluenceTd'> Consumer </td>
<td class='confluenceTd'> Name of the task queue.</td>
</tr>
<tr>
<td class='confluenceTd'> <tt>GTaskBinding.GTASK_TASK_NAME</tt> </td>
<td class='confluenceTd'> <tt>String</tt> </td>
<td class='confluenceTd'> Consumer </td>
<td class='confluenceTd'> Name of the task (generated value).</td>
</tr>
<tr>
<td class='confluenceTd'> <tt>GTaskBinding.GTASK_RETRY_COUNT</tt> </td>
<td class='confluenceTd'> <tt>int</tt> </td>
<td class='confluenceTd'> Consumer </td>
<td class='confluenceTd'>  Number of callback retries.</td>
</tr>
</tbody></table>
</div>


<h3><a name="gtask-Messagebody"></a>Message body</h3>

<p>On the producer side the <tt>in</tt> message body is converted to a <tt>byte[]</tt>
and is POSTed to the callback handler as content-type <tt>application/octet-stream</tt>.</p>

<h3><a name="gtask-Usage"></a>Usage</h3>

<p>Setting up tasks queues is an administrative task on Google App Engine. Only one
queue is pre-configured and can be referenced by name out-of-the-box: the <tt>default</tt>
queue. This queue will be used in the following examples. Please note that when using task
queues on the local development server, tasks must be executed manually from the <a href="http://code.google.com/appengine/docs/java/taskqueue/overview.html#Task_Queues_and_the_Development_Server"
class="external-link" rel="nofollow">developer console</a>.</p>

<h4><a name="gtask-Defaultqueue"></a>Default queue </h4>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Default; brush: java; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
...
.to(gtask:default) // add message to default queue

from(gtask:default) // receive message from default queue (via a web hook)
...
</pre>
</div></div>

<p>This example requires the following servlet mapping.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><b>web.xml</b></div><div class="codeContent
panelContent">
<pre class="theme: Default; brush: xml; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
    ...
    &lt;servlet&gt;
        &lt;servlet-name&gt;CamelServlet&lt;/servlet-name&gt;
        &lt;servlet-class&gt;org.apache.camel.component.servlet.CamelHttpTransportServlet&lt;/servlet-class&gt;
        ...
    &lt;/servlet&gt;
    ...
    &lt;servlet-mapping&gt;
        &lt;servlet-name&gt;CamelServlet&lt;/servlet-name&gt;
        &lt;url-pattern&gt;/worker/*&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
    ...
</pre>
</div></div>

<h3><a name="gtask-Dependencies"></a>Dependencies</h3>

<p>Maven users will need to add the following dependency to their <tt>pom.xml</tt>.
</p>

<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><b>pom.xml</b></div><div class="codeContent
panelContent">
<pre class="theme: Default; brush: xml; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
&lt;dependency&gt;
    &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
    &lt;artifactId&gt;camel-gae&lt;/artifactId&gt;
    &lt;version&gt;x.x.x&lt;/version&gt;
&lt;/dependency&gt;
</pre>
</div></div>

<h3><a name="gtask-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>

<ul class="alternate" type="square">
	<li><a href="/confluence/display/CAMEL/HTTP" title="HTTP">Http component</a></li>
	<li><a href="/confluence/display/CAMEL/SERVLET" title="SERVLET">Servlet component</a></li>
</ul>

    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;" class="grey">
                        <a href="https://cwiki.apache.org/confluence/users/removespacenotification.action?spaceKey=CAMEL">Stop
watching space</a>
            <span style="padding: 0px 5px;">|</span>
                <a href="https://cwiki.apache.org/confluence/users/editmyemailsettings.action">Change
email notification preferences</a>
</div>
        <a href="https://cwiki.apache.org/confluence/display/CAMEL/gtask">View Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=5965072&revisedVersion=6&originalVersion=5">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/CAMEL/gtask?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message