Over a million developers have joined DZone.

Simple Camel Configuration of a Twitter Endpoint

DZone's Guide to

Simple Camel Configuration of a Twitter Endpoint

· Integration Zone ·
Free Resource

Want to learn more about API monitoring? Learn how Trustpilot monitors over 600 microservices with Runscope on this webinar.

I was asked just how my got the Twitter Stream working in my new Camel based project and how I managed the credentials.

The Twitter endpoint works like a dream and this is essentially what my code looks like. All you need is a secrets.properties file in alongside your java file.
 * A Camel Java DSL Router
public class MyRouteBuilder extends RouteBuilder {

	private static final ResourceBundle SECRETS = ResourceBundle

	 * Let's configure the Camel routing rules using Java code...
	 * @throws UnsupportedEncodingException
	public void configure() throws UnsupportedEncodingException {


		String twitter = "twitter://streaming/filter?type=event&keywords="
				+ URLEncoder.encode("london", "utf8");



	private void configureAccess() {
		// setup Twitter component
		TwitterComponent tc = getContext().getComponent("twitter",

Are your customers the first to know when your API is failing? Watch this webinar to learn how Trustpilot monitors over 600 microservices with Runscope, and are always on top of any API errors.


Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}