Tip:
Highlight text to annotate it
X
Here, we'll show you how take David Taieb's Sentiment Analysis of Twitter Hashtags tutorial, add Apache Kafka to the mix
and create a reporting app that takes live sentiment analysis and shows results in a dashboard that updates charts in real time.
We start in Bluemix, IBM's cloud development platform,
where I'm setting up IBM Analytics for Apache Spark service.
I'm adding Object Storage, which will help us manage Spark Streaming
and now I'll create a Scala notebook
via the URL provided in the tutorial.
We'll use this notebook to connect services and control streaming.
We need to return to it a few more times to add credentials.
o I'll leave the notebook open and continue setup in a new tab.
Next, we add Watson Tone Analyzer service,
which provides sentiment analysis in the form of emotional, social, and writing tone scores.
Grab this services credentials and copy them back in the Scala notebook
under Watson Tone Analyzer.
Since we're analyzing Twitter data, grab OAuth credentials off that site and save them.
We'll need them in a few minutes.
Now, back in Bluemix, add the Message Hub service.
This is a high-throughput, message bus service powered by Apache Kafka.
Name it messagehub-spark.
Next, add Message Connect, a streaming service that will connect to our Twitter stream and publish the tweets to Kafka.
Message Connect is still an experimental service, so you may encounter errors.
Don't let it stop you. The tutorial provides a couple of workarounds.
In Message Connect, create your first stream,
name it, and enter your Twitter keys.
To verify that things are set up correctly, open Message Hub,
where you'll see the stream you just created on the dashboard, like this.
Next, I'll open Object Storage and grab its credentials to paste in our notebook.
This solution uses a Swift object container to configure Spark Streaming Checkpointing, and that's where the credentials go.
OK. We've now set up the streaming analytics.
For details on how it all works under the hood, you can read the full tutorial.
Our goal now is to display the results in a dashboard that updates continuously.
That's provided in an app that David created, which I'm now deploying to Bluemix.
Once deployment is done, open the app.
Within Environment Variables, grab its credentials.
We'll paste them in our notebook's Message Hub section.
Once that's done, we're ready to kick things off.
Return to the notebook and run the code.
The first couple cells load our jar file and connect to the services we just set up.
If Message Connect, the experimental service, isn't working for you, there's a workaround.
You can insert your Twitter keys here in cell 3. Otherwise, skip it.
This cell kicks off Spark Streaming.
Wait until you see actual records coming through.
Now the stream is running.
So, launch the dashboard app.
This app was build with the Mozaik framework, which provides an easy-to-use widget framework based on ReactJS components.
Our dashboard is updating in real-time.
This dashboard consumes the output of streaming analytics from Message Hub, and visualizes in live charts.
Now, go try the tutorial yourself.