Overview

Skill Level: Any Skill Level

Developers who want to quickly send data into the cloud. For this recipe, no specific Java knowledge is needed.

Ingredients

Step-by-step

  1. Install Reactive Blocks

    Follow these instructions to install Reactive Blocks.

  2. Import the Example

    • After Eclipse restarted, open the Reactive Blocks perspective: Select Window Open Perspective Other… Reactive Blocks
    • Click the import button in the Blocks View, as shown here:
    • Select Simple Examples and Tutorials
    • The wizard asks you to sign in, using your Google or Facebook Id
    • Import (Level 2) Publish Data to IBM IOT Foundation Quickstart
    • When you finish the wizard, the blocks editor opens with the following application:

    This is how the application works:

    1. Within the init method, we configure the Quickstart block with the necessary parameters. It sets the deviceType and the deviceId. For the quickstart service, we dont need to (in fact, cannot) add authentication credentials.
    2. The Quickstart block connects to IBM, and returns the URL of the web site that will visualize our data. We open that web site with block Open Browser.
    3. We also open the window of the event simulator.
    4. Any event from the simulator is forwarded to the event pin of the quickstart block. This is the data that will be sent to the Watson IoT server.
    5. Once the window is closed, we disconnect and close the application.
  3. Build the Example

    • To generate code, right-click in the blocks editor and select Build / Re-Build for Java Standard Edition
    • The package explorer will open and reveal the generated Java project
  4. Run the Example

    Find the launch configuration, right-click, and select Run As / IOTFoundationQuickstart

    Now the following happens:

    A website opens and shows the IBM Watson IoT Platform Quickstart web site for a new device that the application just created. As our application is not yet sending any data, the website will tell that the device is connected, but that it did not yet receive any data.

    A window opens that lets you simulate data. Whenever you adjust any of the values, a new data event is sent into quickstart. As soon as you send the first data, the website will show the data.

    This is the web site with some data:

  5. Next Steps

    Now that you send in data to IBM Watson IoT Quickstart, you can proceed to build more complex applications:

    • Visit the Reactive Blocks Tutorial Page to learn more about how to build your applications.
    • You can exchange the event simulator block with a block that produces real data, from a real sensor.
    • Build more complex applications with more features of IBM Watson IoT Platform, described in this recipe.

Expected Outcome

The outcome of this tutorial is a running application that sends simulated data into the IoT Foundation Quickstart service. It's easy to extend this running application to send in other data and take it as starting point for your own applications.

1 comment on"Reactive Blocks to IBM Watson IoT Platform (Part 1: Quickstart)"

  1. There don’t seem to be any instructions for Linux users. 🙁

    I use the Raspberry Pi (Raspbian) extensively.

Join The Discussion