Table of contents

Setting up with Eclipse/Streams Studio

If you already have a Streams v4.x installation, you can manually install this toolkit with Eclipse.

  1. Download the latest release from here: https://github.com/IBMStreams/streamsx.topology/releases
  2. Unzip the streamsx.topology*.tar.gz file onto the file system.
  3. Start Eclipse / Streams Studio.
  4. Set up classpath variable in your workspace:
    1. Open Windows -> Preferences -> Java -> Build Path -> Classpath Variables
    2. Click New...
    3. In the New Variable Entry dialog, provide a name for the library. I put mine as "STREAMS_JAVA_FUNCTIONAL_API".
    4. Click Fileā€¦
    5. Browse to locate the following file: <streamsx.topology install path>/com.ibm.streamsx.topology/lib/com.ibm.streamsx.topology.jar

This completes the installation of the streamsx.topology project. The steps above are specific to installing the Java Application API libraries in Eclipse or Streams Studio (or any Java IDE, really).
If you haven't yet linked Eclipse/Streams Studio with IBM Streams, ensure the following jar files are part of the classpath:

Importing samples in Eclipse

  1. File -> Import -> General -> Existing Projects into Workspace
  2. Browse to /samples/java/functional directory as the root to import.
  3. Select JavaFunctionalAPISamples.
  4. Select Copy projects into workspace
This will import the sample project into your workspace. The project expect a classpath variable named STREAMS_JAVA_FUNCTIONAL_API. If you haven't yet, follow the steps from previous section to define this classpath variable.

Exploring the Samples

The Java Application API contains a number of samples to help you learn the API. For a list of all samples available, refer to this page: Java Application APIs Samples

Running the Samples

Before you can run the samples, you need to set up the Streams environment. If you've already configured and started your Streams domain, instance, and Zookeeper instances, you may skip the next section. Otherwise, follow these steps to set up the Streams environment.

Setting up Streams Runtime Environment

  1. Set up Streams environment by running the streamsprofile.sh.
  2. Go to $STREAMS_INSTALL/bin directory and run the following command:

    source streamsprofile.sh

  3. Set STREAMS_ZKCONNECT environment - This is the Zookeeper ensemble to be used by Streams.
  4. Follow this guide to create a domain and an instance: Domain Setup Guide
  5. Set the following environments. These environments are used for the Java Application APIs to determine the domain and instance to use when application is launched in distributed mode.
    • STREAMS_DOMAIN_ID - Streams domain to launch a distributed application to
    • STREAMS_INSTANCE_ID - Streams instance to launch a distributed application to

You can run the sample like any Java application in Eclipse. To run the samples:

  1. Create a new Java launch configuration of the sample that you want to run. For example, if you would like to run the simple.HelloWorld sample, create a Java launch configuration for the HelloWorld class.
  2. In the Java launch configuration dialog, open the Arguments.
  3. In the Arguments, specify one of the following values as the Program Arguments
    • EMBEDDED - Run the application in embedded mode. This is a simulated Java environment for running your Streams application.
    • DISTRIBUTED - Run the application in distributed mode. When an application is submitted with this context, a Streams Application Bundle (.sab file) is produced. The .sab file contains all of the application's logic and third-party dependencies, and is submitted to a Streams instance automatically.
    • STANDALONE - Run the application in stand alone mode. When running in this mode, the application also produces a Streams Applicaition Bundle (.sab file), but rather than submitting it to a cluster, the bundle is instead executable. The bundle will run within its own process, and may be terminated with ctrl-C interrupts.