[Update: April 5th, 2016 – The Live3 on HCP tutorial series was created using the SAP HANA Cloud Platform free developer trial landscape in January 2015. The HCP landscape has significantly evolved over the past year. Therefore one may encounter many issues while following along with the series using the most recent version of the free developer trail edition of HCP.]
The SAP HANA Academy’s Philip Mugglestone continues the Live3 course by showing how to use the node.js application to query the Twitter streaming API to load tweets with a desired keyword into the SAP HANA instance within the SAP HANA Cloud Platform. Check out Philip’s tutorial video below.
(0:40 – 1:45) How to Run the Node.js Application
Open a command line window on the node.js folder. Type in node app.js and hit enter to run the application. Now the node.js application will be listening on a consistent basis for us to send it instructions to retrieve data from Twitter and then load it into SAP HANA. Note what port the node.js application is listening on.
(1:45 – 4:05) How to Make Calls to the Node.js Application from a Web Browser to Track Keywords on Twitter
Open a web browser (Chrome in Philip’s demonstration) and navigate to the application by entering localhost:8888 (port number). “Cannot GET/” will be displayed because we didn’t specify a URL.
Entering localhost:8888/do/start will display “Nothing to track” as we have yet to specify what we want to track. To track anything you want on Twitter (e.g. company name, product, service) enter localhost:8888/do/start?track=xyz123. For this demonstration Philip tracks “ausopen” – a Tennis tournament occurring at the time of the tutorial’s filiming.
Open the command window after hitting enter to view a log entry documenting every tweet that is captured and loaded into the SAP HANA database.
(4:05 – 7:05) Viewing the Data in the Tweets Table in Eclipse and How to Stop the Twitter Streaming API
Back in Eclipse click refresh on the Tweets table to view the data that is loaded from the Twitter API in real-time.
In the web browser if you enter localhost:8888/do/stop then no more Tweets will be loaded into SAP HANA.
Now the tunnel must always be open for node.js to talk to the SAP HANA instance. This is perfect for our demonstration using the SAP HANA Cloud Platform Developer trial edition. If you are using a productive SAP HANA Cloud Platform instance than you will not need the tunnel to connect and the 24 hour restriction won’t apply.
Follow along with the Live3 course here.
SAP HANA Academy over 900 free tutorial videos on using SAP HANA and SAP HANA Cloud Platform.