Skip to Content

[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.

Screen Shot 2015-03-05 at 10.29.32 AM.png

(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.

Screen Shot 2015-03-05 at 10.44.05 AM.png

(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.

Screen Shot 2015-03-05 at 10.46.27 AM.png

(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.


Follow @saphanaacademy

To report this post you need to login first.

9 Comments

You must be Logged on to comment or reply to a post.

  1. Joe Zhou

    hi  expert,

    I’m really got crazy about this step “load tweets”.  this is the error log:

    Error: getaddrinfo ENOTFOUND userstream.twitter.com userstream.twitter.com:443

        at errnoException (dns.js:26:10)

        at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:77:26)

    everything is ok util I enter the http://localhost:8888/do/start?track=ausopen  the page shows “start” while the cmd shows the error

    PlZ help me !!!!!!!!

    (0) 
    1. Tom Flanagan Post author

      Hi Joe,

      Please follow me on SCN so I can send you a direct message. Much easier to explain your probable situation with a firewall there then in the comments.

      Thanks,

      Tom

      (0) 
      1. Joe Zhou

        Hi Tom,

        How are you!

        I’m following your live 3 tutorial on youtube now I’m on video 28 “WEB IDE Templates”, here I meet some error when I fill in the “paste URL here” with my url: /i321098trial/joe/live3/services.xsodata     ( location:web ide/ fiori master master detail application/ service information ). It shows :

        Cannot parse the metadata file.

        And my command prompt also alert me the error :

        C:\Users\I321098\Desktop\demo project\hanatrial-auth-proxy\hanatrial-auth-proxy-

        master\examples>node server-basic-auth.js

        SAP HANA Cloud Trial Authentication Proxy for HANA XS Services ready: http://loc

        alhost:7891

        GET /i321098trial/joe/live3/$metadata

        Get new session cookie

        GET /i321098trial/joe/live3/services.xsodata/$metadata

        Get new session cookie

        Response is undefined

        problem with request: getaddrinfo ENOTFOUND s9hanaxs.hanatrial.ondemand.com s9ha

        1. naxs.hanatrial.ondemand.com:443

        Response is undefined

        problem with request: getaddrinfo ENOTFOUND s9hanaxs.hanatrial.ondemand.com s9ha

        1. naxs.hanatrial.ondemand.com:443

        actually before this, I also met a proxy issue on video 23 “Authentication Setup Proxy” , when I enter in command with “node server-basic-auth.js” and go to http://localhost:7891/i321098trial/joe/live3/services.xsodata, the prompt also alert me with the exactly error like above.

        I think this is a proxy problem, would you please teach me how to fix it? Really appreciate your reply.

        Best Regards

        Joe

        (0) 
  2. Patrick BECH

    Hello Philip and any live3 user and tester, would you mind to show me a screenshot of your Eclipse environment? Windows->Preferences->Server->HANA Cloud Platform And on the live3 Eclipse project letf side “right-click” Properties->”Java Build Path” and “Java Compiler”. Thx Patrick

    (0) 
  3. Patrick BECH

    Hi Philip, I dont thnk I am helping you much here. Pls dont touche anything on your Eclipse configuration. I just wanted to verify the Java settings. For the other settings, you can go to Eclipse left side, select the project name (is it live3?)and right-clic on it, then select “Properties” and you will see the “Java Build Path” and “Java Compiler” settings. Regarding your timeout problem, looks like you are on HCP Live3 video #25. Is it the case? Thx, Patrick

    (0) 
    1. Sujith Philip Philipose

      Hi Patrick,

      Thanks for whatever you are doing.

      regarding the Eclipse project … I havent reached an Eclipse project yet! I am on the
      Live 3 – SAP HCP for Advanced real-time social media analytics video 11.

      But if it helps, the following are the values of my Hello World projectBuild_path.png/wp-content/uploads/2016/03/compiler_902087.png

      (0) 

Leave a Reply