Using Kafka producer to store the tweets in a Kafka cluster

In this section, we are going to cover how we can stream the tweets from Twitter using the twitter streaming API. We are also going to cover how we can store the fetched tweets in Kafka for later processing through Storm.

We are assuming you already have a twitter account, and that the consumer key and access token are generated for your application. You can refer to: https://bdthemes.com/support/knowledge-base/generate-api-key-consumer-token-access-key-twitter-oauth/ to generate a consumer key and access token. Take the following steps:

  1. Create a new maven project with groupId, com.stormadvance and artifactId, kafka_producer_twitter.

 

  1. Add the following dependencies to the pom.xml ...

Get Mastering Apache Storm now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.