StreamsContext.Type (Java Application API for IBM Streams)
Date: 2020-08-07

com.ibm.streamsx.topology.context

## Enum StreamsContext.Type

- java.lang.Object
- - java.lang.Enum<StreamsContext.Type>
  - - com.ibm.streamsx.topology.context.StreamsContext.Type

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<StreamsContext.Type>
  Enclosing interface:
    StreamsContext<T>

      public static enum StreamsContext.Type
      extends java.lang.Enum<StreamsContext.Type>

  Types of the `IBM Streams context` that a `Topology` can be executed against.

- - ### Enum Constant Summary

    Enum Constants
    Enum Constant and Description
    `ANALYTICS_SERVICE` Deprecated. Use `STREAMING_ANALYTICS_SERVICE`
    `BUILD_ARCHIVE` Execution of the topology produces the application a Streams build archive.
    `BUNDLE` Submission of the topology produces an Streams application bundle.
    `DISTRIBUTED` The topology is submitted to an IBM Streams instance.
    `DISTRIBUTED_TESTER` Testing variant of `DISTRIBUTED_TESTER`.
    `EDGE` Submission of the topology produces an Streams Docker image on the build service for Edge.
    `EDGE_BUNDLE` Submission of the topology produces a bundle for a Streams Docker image for debug purpose.
    `EMBEDDED` Topology is executed within the Java virtual machine that declared it.
    `EMBEDDED_TESTER` Testing variant of `EMBEDDED`.
    `STANDALONE` The topology is executed directly as an Streams standalone application.
    `STANDALONE_BUNDLE` Deprecated. Use `BUNDLE` - A single bundle now works for both distributed and standalone.
    `STANDALONE_TESTER` Testing variant of `STANDALONE`.
    `STREAMING_ANALYTICS_SERVICE` The topology is submitted to a Streams instance running in Streaming Analytics service on IBM Cloud cloud platform.
    `STREAMING_ANALYTICS_SERVICE_TESTER` Testing variant of `STREAMING_ANALYTICS_SERVICE`.
    `TOOLKIT` Execution of the topology produces the application as a Streams toolkit.

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static StreamsContext.Type` | `valueOf(java.lang.String name)` Returns the enum constant of this type with the specified name.
    `static StreamsContext.Type[]` | `values()` Returns an array containing the constants of this enum type, in the order they are declared.

    - ### Methods inherited from class java.lang.Enum

      `clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

    - ### Methods inherited from class java.lang.Object

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### Enum Constant Detail

    - #### EDGE

          public static final StreamsContext.Type EDGE

      Submission of the topology produces an Streams Docker image on the build service for Edge.

    - #### EDGE_BUNDLE

          public static final StreamsContext.Type EDGE_BUNDLE

      Submission of the topology produces a bundle for a Streams Docker image for debug purpose.

    - #### EMBEDDED

          public static final StreamsContext.Type EMBEDDED

      Topology is executed within the Java virtual machine that declared it. This requires that the topology only contains Java functions or primitive operators.

    - #### TOOLKIT

          public static final StreamsContext.Type TOOLKIT

      Execution of the topology produces the application as a Streams toolkit.

      The returned type for the `submit` calls is a `Future&lt;File>` where the value is the location of the toolkit.
      The `Future` returned from `submit()` will always be complete when the `submit()` returns.

    - #### BUILD_ARCHIVE

          public static final StreamsContext.Type BUILD_ARCHIVE

      Execution of the topology produces the application a Streams build archive.

      The returned type for the `submit` calls is a `Future&lt;File>` where the value is the location of the build archive.
      The `Future` returned from `submit()` will always be complete when the `submit()` returns.

    - #### BUNDLE

          public static final StreamsContext.Type BUNDLE

      Submission of the topology produces an Streams application bundle.

      A bundle (`.sab` file) can be submitted to a Streaming Analytics service running on IBM Cloud using:

      - Streaming Analytics Console
      - Streaming Analytics REST API
      The `STREAMING_ANALYTICS_SERVICE` context submits a topology directly to a Streaming Analytics service.

      A bundle (`.sab` file) can be submitted to an IBM Streams instance using:

      - `streamtool submitjob` from the command line
      - IBM Streams Console
      - IBM Streams JMX API
      The `DISTRIBUTED` context submits a topology directly to a Streams instance.

      The returned type for the `submit` calls is a `Future<File>` where the value is the location of the bundle.
      If running with IBM Streams 4.2 or later then additionally a job configuration overlays file is produced. This file provides the correct job deployment instructions to enforce any constraints declared in the `Topology`. The file is located in the same directory as the application bundle with a suffix of `json` and the name of the application bundle file (without the `sab` suffix} with `_JobConfig` appended. For example for the application bundle `simple.HelloWorld.sab` its job configuration overlays file would be `simple.HelloWorld_JobConfig.json`.

           Example of using job configuration overlays file at submit job time with  streamtool:

           streamtool submitjob --jobConfig simple.HelloWorld_JobConfig.json simple.HelloWorld.sab

      The `Future` returned from `submit()` will always be complete when the `submit()` returns.

    - #### STANDALONE_BUNDLE

          public static final StreamsContext.Type STANDALONE_BUNDLE

      Deprecated. Use `BUNDLE` - A single bundle now works for both distributed and standalone.
      Execution of the topology produces an SPL application bundle `.sab` file that can be executed as an IBM Streams standalone application.

      The returned type for the `submit` calls is a `Future&lt;File>` where the value is the location of the bundle.
      The `Future` returned from `submit()` will always be complete when the `submit()` returns.

    - #### STANDALONE

          public static final StreamsContext.Type STANDALONE

      The topology is executed directly as an Streams standalone application. The standalone execution is spawned as a separate process from the Java virtual machine.

      The returned type for the `submit` calls is a `Future&lt;Integer>` where the value is return code from the standalone execution.
      The `Future` returned from `submit()` will be complete, when the standalone executable terminates. This will only occur if all the streams in the topology finalize, so that all the operators complete. Thus some topologies, for example those polling external data sources, will run until cancelled.
      Calling `Future.cancel(true)` will terminate the standalone executable.

    - #### DISTRIBUTED

          public static final StreamsContext.Type DISTRIBUTED

      The topology is submitted to an IBM Streams instance.

      The returned type for the `submit` calls is a `Future&lt;BigInteger>` where the value is the job identifier.
      When `submit` returns the `Future` will be complete, but the Streams job will still be running, as typically distributed jobs are long running, consuming continuous streams of data.

      The Streams instance the topology is submitted to is defined by the required environment variables `STREAMS_DOMAIN_ID` and `STREAMS_INSTANCE_ID`. `STREAMS_ZKCONNECT` must also be set for a non-basic instance, one not using embedded ZooKeeper.
      The user is set by the optional environment variable `STREAMS_USERNAME` defaulting to the current operator system user name.

      `streamtool` is used to submit the job and requires that `streamtool` does not prompt for authentication. This is achieved by using `streamtool genkey`.

      See Also:
        Generating authentication keys for IBM Streams

    - #### EMBEDDED_TESTER

          public static final StreamsContext.Type EMBEDDED_TESTER

      Testing variant of `EMBEDDED`. This allows testing frameworks to capture the output of unconnected `streams` in the topology using the facilities of `Tester`. This allows `JUnit` style testing of topologies, including individual functional streams, and sub-topologies.

    - #### STANDALONE_TESTER

          public static final StreamsContext.Type STANDALONE_TESTER

      Testing variant of `STANDALONE`. This allows testing frameworks to capture the output of unconnected `streams` in the topology using the facilities of `Tester`. This allows `JUnit` testing of topologies, including individual functional streams, sub-topologies, and, SPL primitive operators and composites.

    - #### DISTRIBUTED_TESTER

          public static final StreamsContext.Type DISTRIBUTED_TESTER

      Testing variant of `DISTRIBUTED_TESTER`. This allows testing frameworks to capture the output of unconnected `streams` in the topology using the facilities of `Tester`. This allows `JUnit` testing of topologies, including individual functional streams, sub-topologies, and, SPL primitive operators and composites.

    - #### ANALYTICS_SERVICE

          public static final StreamsContext.Type ANALYTICS_SERVICE

      Deprecated. Use `STREAMING_ANALYTICS_SERVICE`
      The topology is submitted to a Streams instance running in Streaming Analytics service on IBM Cloud cloud platform.

      This is a synonym for `STREAMING_ANALYTICS_SERVICE`.

    - #### STREAMING_ANALYTICS_SERVICE

          public static final StreamsContext.Type STREAMING_ANALYTICS_SERVICE

      The topology is submitted to a Streams instance running in Streaming Analytics service on IBM Cloud cloud platform.

      The returned type for the `submit` calls is a `Future<BigInteger>` where the value is the job identifier.
      When `submit` returns the `Future` will be complete, but the Streams job will still be running, as typically distributed jobs are long running, consuming continuous streams of data.

      The name of the Streaming Analytics Service must be set as a configuration property for a submit, using `AnalyticsServiceProperties.SERVICE_NAME`. The definition for the service is defined one of two ways:

      - Using the configuration property `AnalyticsServiceProperties.VCAP_SERVICES`. This takes precedence over the environment variable.
      - Using the environment variable `VCAP_SERVICES`

      If the environment variable `STREAMS_INSTALL` is set to a non-empty value then a Streams Application bundle (`sab` file) is created locally using the IBM Streams install and submitted to the service. This may be overridden by setting the context property `FORCE_REMOTE_BUILD` to `true`.

    - #### STREAMING_ANALYTICS_SERVICE_TESTER

          public static final StreamsContext.Type STREAMING_ANALYTICS_SERVICE_TESTER

      Testing variant of `STREAMING_ANALYTICS_SERVICE`.

      This context ignores any local IBM Streams install defined by the environment variable `STREAMS_INSTALL`, thus the Streams Application bundle (`sab` file) is created using the build service.

      Since:
        1.7

  - ### Method Detail

    - #### values

          public static StreamsContext.Type[] values()

      Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:

          for (StreamsContext.Type c : StreamsContext.Type.values())
              System.out.println(c);

      Returns:
        an array containing the constants of this enum type, in the order they are declared

    - #### valueOf

          public static StreamsContext.Type valueOf(java.lang.String name)

      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
        `name` - the name of the enum constant to be returned.
      Returns:
        the enum constant with the specified name
      Throws:
        `java.lang.IllegalArgumentException` - if this enum type has no constant with the specified name
        `java.lang.NullPointerException` - if the argument is null