Contents


Overview

Skill Level: Beginner

Beginner

This recipe is going to connect your Edgent on Pi to the Streaming Analytics Service.

Ingredients

Step-by-step

  1. Introduction

    This recipe is going to pick up where our Apache Edgent on Pi to Watson IoT Platform recipe left off from. Your Raspberry Pi is sending useful information to Watson IoT, so now we want to do some back end processing using the Streaming Analytics Bluemix service.

    Apache Edgent (incubating*) is made for running analytics at the edge, but there are a lot of cases where you need a centralized streaming analytics hub–that’s where the Streaming Analytics service comes in. Using the IBM Streams-powered Streaming Analytics service opens you up to dozens of toolkits and several hundred operators that are already made to connect to the messaging servers and databases you care about, run the analytics you want, and much more.

    Find the latest version of the recipe here: https://developer.ibm.com/recipes/tutorials/connect-apache-edgent-to-the-streaming-analytics-service-using-the-watson-iot-platform/

9 comments on"Connect Apache Edgent on Pi to the Streaming Analytics Service"

  1. Aarushi_Mittal May 11, 2017

    @Alex Cook where do we have to write this code ?
    On Eclipse ?
    Also , how does streaming analytics service communicate with eclipse made code ??
    Really confused.
    Spent a month on this

    • Alex Cook May 11, 2017

      @Aarushi_Mittal, it shouldn’t matter where you write your code. The build/run commands provided should be sufficient. The job gets submitted using a REST API and the actual job runs on Bluemix. Feel free to post errors in your comments to provide more context.

      • Aarushi_Mittal May 11, 2017

        @Alex Cook thanks for the quick response
        for this command : $ javac -cp $STREAMS_TOOLKITS/com.ibm.streamsx.iot/lib/com.ibm.streamsx.iot.jar:$STREAMS_TOOLKITS/com.ibm.streamsx.topology/lib/com.ibm.streamsx.topology.jar:$STREAMS_INSTALL/lib/com.ibm.streams.operator.samples.jar -d bin src/com/ibm/streamsx/iot/sample/IotSensors.java

        i need streams installed ..
        where do i install it ? on my windows machine ?
        Also how to proceed further?
        i coded on eclipse, but i dont have streams so it wont compile correctly. also the code does not receive any readings that pi is sending to watson iot? I did not understand that piece of architecture.

        • Alex Cook May 11, 2017

          In step 4:
          > Before we jump into the code, you will need access to an installation of IBM Streams. You can download the IBM Streams Quick Start for free.

          The link for the quickstart is here: http://www.ibm.com/analytics/us/en/technology/stream-computing/
          You will need to use the VM image to run on a Windows machine.

          • Aarushi_Mittal May 11, 2017

            yes i downloaded the vm image
            Now whats next
            My vm image is working and i am able to see the sysadmin desktop

          • Alex Cook May 11, 2017

            Are you running/building your code in the VM so that it has access to the Streams install?

          • Aarushi_Mittal May 11, 2017

            No.
            I copied the jar samples.operator to my local windows machine from the VM
            then added it as an external jar to my eclipse project.
            Now i am trying to run it from the command line

          • Aarushi_Mittal May 11, 2017

            Also how are Streaming analytics service , my eclipse project and the Part 1 setup( code running on raspberry pi that i sending data to IoT Watson Platform) communicating ?
            What is the architecture there ?

          • Aarushi_Mittal May 11, 2017

            Exception in thread “main” java.lang.Error: Unresolved compilation problems:
            JSONObject cannot be resolved to a type
            The method transform(Function) from the type TStream refers to the missing type JSONObject
            This lambda expression refers to the missing type JSONObject
            JSONObject cannot be resolved to a type
            The method getPayload() from the type DeviceEvent refers to the missing type JSONObject
            The method aggregate(Function<List,A>) in the type TWindow is not applicable for the arguments (new Function<List,Double>(){})
            JSONObject cannot be resolved to a type
            JSONObject cannot be resolved to a type
            The method getPayload() from the type DeviceEvent refers to the missing type JSONObject
            Cannot infer type arguments for HashMap
            The method put(String, File) is undefined for the type Map
            The method put(String, String) is undefined for the type Map
            ANALYTICS_SERVICE cannot be resolved or is not a field

            at IotSensors.main(IotSensors.java:63)

            I am getting these errors on compilation

Join The Discussion