Available as of Camel 2.10

The Twitter component enables the most useful features of the Twitter API by encapsulating Twitter4J. 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.

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 and grant the application access to your account. Finally, generate your access token and secret.

URI format


Consumer Endpoints:

Endpoint Context Body Type
directmessage direct, polling List<twitter4j.DirectMessage>
search direct, polling List<twitter4j.Tweet>
streaming/filter event, polling List<twitter4j.Status>
streaming/sample event, polling event: twitter4j.Status, polling: List<twitter4j.Status>
timeline/home direct, polling List<twitter4j.Status>
timeline/mentions direct, polling List<twitter4j.Status>
timeline/public direct, polling List<twitter4j.Status>
timeline/retweetsofme direct, polling List<twitter4j.Status>
timeline/user direct, polling List<twitter4j.Status>

Producer Endpoints:

Endpoint Body Type
directmessage String
timeline/user String

URI Options

Name Default Value Description
type direct direct, event, or polling
delay 60 in seconds
*consumerKey null Consumer Key
*consumerSecret null Consumer Secret
*accessToken null Access Token
*accessTokenSecret null Access Token Secret
user null Username, used for user timeline consumption, direct message production, etc.
keywords null 'lat,lon;lat,lon;...' Can be used for streaming/filter
userIds null 'username,username...' Can be used for streaming/filter
Options: (* = required).

Message body

All message bodies utilize objects provided by the Twitter4J API.

Maven Dependency:


Use cases

To create a status update within your Twitter profile, send this producer a String body.


To poll, every 5 sec., all statuses on your home timeline:


To search for all statuses with the keyword 'camel':


See Also

© 2004-2011 The Apache Software Foundation.
Apache Camel, Camel, Apache, the Apache feather logo, and the Apache Camel project logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.
Graphic Design By Hiram