camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Camel > Twitter
Date Sun, 25 Mar 2012 12:03: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/Twitter">Twitter</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~davsclaus">Claus
Ibsen</a>
    </h4>
        <br/>
                         <h4>Changes (6)</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" >{code} <br> <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">h3.
TwitterComponent: <br> <br>The twitter component can be configured with the Twitter
account settings which is mandatory to configure before using. <br>You can also configure
these options directly in the endpoint. <br>{div:class=confluenceTableSmall} <br>||
Option || Description || <br>| consumerKey | The consumer key | <br>| consumerSecret
| The consumer secret | <br>| accessToken | The access token | <br>| accessTokenSecret
| The access token secret | <br>{div} <br> <br></td></tr>
            <tr><td class="diff-unchanged" >h3. Consumer Endpoints: <br>{div:class=confluenceTableSmall}
<br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >| type | direct | direct, event, or
polling | <br>| delay | 60 | in seconds | <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">|
*consumerKey | {{null}} | Consumer Key | <br>| *consumerSecret | {{null}} | Consumer
Secret | <br>| *accessToken | {{null}} | Access Token | <br>| *accessTokenSecret
| {{null}} | Access Token Secret | <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">|
consumerKey | {{null}} | Consumer Key. Can also be configured on the {{TwitterComponent}}
level instead. | <br>| consumerSecret | {{null}} | Consumer Secret. Can also be configured
on the {{TwitterComponent}} level instead. | <br>| accessToken | {{null}} | Access Token.
Can also be configured on the {{TwitterComponent}} level instead. | <br>| accessTokenSecret
| {{null}} | Access Token Secret. Can also be configured on the {{TwitterComponent}} level
instead. | <br></td></tr>
            <tr><td class="diff-unchanged" >| user | {{null}} | Username, used
for user timeline consumption, direct message production, etc. | <br>| keywords| {{null}}
| &#39;lat,lon;lat,lon;...&#39; Can be used for streaming/filter | <br>| userIds|
{{null}} | &#39;username,username...&#39; Can be used for streaming/filter | <br>
<br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">{info:title=Note}
<br>Options: (* = required). <br>{info} <br> <br></td></tr>
            <tr><td class="diff-unchanged" >h3. Message body <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >twitter://search?type=direct&amp;keywords=camel&amp;consumerKey=[s]&amp;consumerSecret=[s]&amp;accessToken=[s]&amp;accessTokenSecret=[s]
<br>{code} <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">
<br>h3. Example <br>See also the [Twitter Websocket Example]. <br> <br></td></tr>
            <tr><td class="diff-unchanged" >{include:Endpoint See Also} <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">-
[Twitter Websocket Example] <br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h2><a name="Twitter-Twitter"></a>Twitter</h2>
<p><b>Available as of Camel 2.10</b></p>

<p>The Twitter component enables the most useful features of the Twitter API by encapsulating
<a href="http://twitter4j.org/" class="external-link" rel="nofollow">Twitter4J</a>.
It allows direct, polling, or event-driven consumption of timelines, users, trends, and direct
messages. Also, it supports producing messages as status updates or direct messages.</p>

<p>Twitter now requires the use of OAuth for all client application authentication.
 In order to use camel-twitter with your account, you'll need to create a new application
within Twitter at <a href="https://dev.twitter.com/apps/new" class="external-link" rel="nofollow">https://dev.twitter.com/apps/new</a>
and grant the application access to your account. Finally, generate your access token and
secret.</p>

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

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

<h3><a name="Twitter-TwitterComponent%3A"></a>TwitterComponent:</h3>

<p>The twitter component can be configured with the Twitter account settings which is
mandatory to configure before using.<br/>
You can also configure these options directly in the endpoint.</p>
<div class="confluenceTableSmall"><div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Option </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> consumerKey </td>
<td class='confluenceTd'> The consumer key </td>
</tr>
<tr>
<td class='confluenceTd'> consumerSecret </td>
<td class='confluenceTd'> The consumer secret </td>
</tr>
<tr>
<td class='confluenceTd'> accessToken </td>
<td class='confluenceTd'> The access token </td>
</tr>
<tr>
<td class='confluenceTd'> accessTokenSecret </td>
<td class='confluenceTd'> The access token secret </td>
</tr>
</tbody></table>
</div>
</div>

<h3><a name="Twitter-ConsumerEndpoints%3A"></a>Consumer Endpoints:</h3>
<div class="confluenceTableSmall"><div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Endpoint </th>
<th class='confluenceTh'> Context </th>
<th class='confluenceTh'> Body Type </th>
</tr>
<tr>
<td class='confluenceTd'> directmessage </td>
<td class='confluenceTd'> direct, polling </td>
<td class='confluenceTd'> List&lt;twitter4j.DirectMessage&gt; </td>
</tr>
<tr>
<td class='confluenceTd'> search </td>
<td class='confluenceTd'> direct, polling </td>
<td class='confluenceTd'> List&lt;twitter4j.Tweet&gt; </td>
</tr>
<tr>
<td class='confluenceTd'> streaming/filter </td>
<td class='confluenceTd'> event, polling </td>
<td class='confluenceTd'> List&lt;twitter4j.Status&gt; </td>
</tr>
<tr>
<td class='confluenceTd'> streaming/sample </td>
<td class='confluenceTd'> event, polling </td>
<td class='confluenceTd'> event: twitter4j.Status, polling: List&lt;twitter4j.Status&gt;
</td>
</tr>
<tr>
<td class='confluenceTd'> timeline/home </td>
<td class='confluenceTd'> direct, polling </td>
<td class='confluenceTd'> List&lt;twitter4j.Status&gt; </td>
</tr>
<tr>
<td class='confluenceTd'> timeline/mentions </td>
<td class='confluenceTd'> direct, polling </td>
<td class='confluenceTd'> List&lt;twitter4j.Status&gt; </td>
</tr>
<tr>
<td class='confluenceTd'> timeline/public </td>
<td class='confluenceTd'> direct, polling </td>
<td class='confluenceTd'> List&lt;twitter4j.Status&gt; </td>
</tr>
<tr>
<td class='confluenceTd'> timeline/retweetsofme </td>
<td class='confluenceTd'> direct, polling </td>
<td class='confluenceTd'> List&lt;twitter4j.Status&gt; </td>
</tr>
<tr>
<td class='confluenceTd'> timeline/user </td>
<td class='confluenceTd'> direct, polling </td>
<td class='confluenceTd'> List&lt;twitter4j.Status&gt; </td>
</tr>
</tbody></table>
</div>
</div>

<h3><a name="Twitter-ProducerEndpoints%3A"></a>Producer Endpoints:</h3>
<div class="confluenceTableSmall"><div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Endpoint </th>
<th class='confluenceTh'> Body Type </th>
</tr>
<tr>
<td class='confluenceTd'> directmessage </td>
<td class='confluenceTd'> String </td>
</tr>
<tr>
<td class='confluenceTd'> timeline/user </td>
<td class='confluenceTd'> String </td>
</tr>
</tbody></table>
</div>
</div>

<h3><a name="Twitter-URIOptions"></a>URI 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'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> type </td>
<td class='confluenceTd'> direct </td>
<td class='confluenceTd'> direct, event, or polling </td>
</tr>
<tr>
<td class='confluenceTd'> delay </td>
<td class='confluenceTd'> 60 </td>
<td class='confluenceTd'> in seconds </td>
</tr>
<tr>
<td class='confluenceTd'> consumerKey </td>
<td class='confluenceTd'> <tt>null</tt> </td>
<td class='confluenceTd'> Consumer Key. Can also be configured on the <tt>TwitterComponent</tt>
level instead. </td>
</tr>
<tr>
<td class='confluenceTd'> consumerSecret </td>
<td class='confluenceTd'> <tt>null</tt> </td>
<td class='confluenceTd'> Consumer Secret. Can also be configured on the <tt>TwitterComponent</tt>
level instead. </td>
</tr>
<tr>
<td class='confluenceTd'> accessToken </td>
<td class='confluenceTd'> <tt>null</tt> </td>
<td class='confluenceTd'> Access Token. Can also be configured on the <tt>TwitterComponent</tt>
level instead. </td>
</tr>
<tr>
<td class='confluenceTd'> accessTokenSecret </td>
<td class='confluenceTd'> <tt>null</tt> </td>
<td class='confluenceTd'> Access Token Secret. Can also be configured on the <tt>TwitterComponent</tt>
level instead. </td>
</tr>
<tr>
<td class='confluenceTd'> user </td>
<td class='confluenceTd'> <tt>null</tt> </td>
<td class='confluenceTd'> Username, used for user timeline consumption, direct message
production, etc. </td>
</tr>
<tr>
<td class='confluenceTd'> keywords</td>
<td class='confluenceTd'> <tt>null</tt> </td>
<td class='confluenceTd'> 'lat,lon;lat,lon;...' Can be used for streaming/filter </td>
</tr>
<tr>
<td class='confluenceTd'> userIds</td>
<td class='confluenceTd'> <tt>null</tt> </td>
<td class='confluenceTd'> 'username,username...' Can be used for streaming/filter </td>
</tr>
</tbody></table>
</div>


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

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
All message bodies utilize objects provided by the Twitter4J API.
</pre>
</div></div>

<h3><a name="Twitter-MavenDependency%3A"></a>Maven Dependency:</h3>
<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-twitter<span
class="code-tag">&lt;/artifactId&gt;</span>
    <span class="code-tag">&lt;version&gt;</span>${camel-version}<span
class="code-tag">&lt;/version&gt;</span>
<span class="code-tag">&lt;/dependency&gt;</span>
</pre>
</div></div>

<h3><a name="Twitter-Usecases"></a>Use cases</h3>

<h4><a name="Twitter-TocreateastatusupdatewithinyourTwitterprofile%2CsendthisproduceraStringbody."></a>To
create a status update within your Twitter profile, send this producer a String body.</h4>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
twitter:<span class="code-comment">//timeline/user?consumerKey=[s]&amp;consumerSecret=[s]&amp;accessToken=[s]&amp;accessTokenSecret=[s]</span>
</pre>
</div></div>
<h4><a name="Twitter-Topoll%2Cevery5sec.%2Callstatusesonyourhometimeline%3A"></a>To
poll, every 5 sec., all statuses on your home timeline:</h4>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
twitter:<span class="code-comment">//timeline/home?type=polling&amp;delay=5&amp;consumerKey=[s]&amp;consumerSecret=[s]&amp;accessToken=[s]&amp;accessTokenSecret=[s]</span>
</pre>
</div></div>
<h4><a name="Twitter-Tosearchforallstatuseswiththekeyword%27camel%27%3A"></a>To
search for all statuses with the keyword 'camel':</h4>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
twitter:<span class="code-comment">//search?type=direct&amp;keywords=camel&amp;consumerKey=[s]&amp;consumerSecret=[s]&amp;accessToken=[s]&amp;accessTokenSecret=[s]</span>
</pre>
</div></div>

<h3><a name="Twitter-Example"></a>Example</h3>
<p>See also the <a href="/confluence/display/CAMEL/Twitter+Websocket+Example" title="Twitter
Websocket Example">Twitter Websocket Example</a>.</p>

<h3><a name="Twitter-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/Twitter+Websocket+Example" title="Twitter
Websocket Example">Twitter Websocket Example</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/Twitter">View Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=27837225&revisedVersion=5&originalVersion=4">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/CAMEL/Twitter?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message