FunctionContainer (Java Application API for IBM Streams)
Date: 2020-08-07

com.ibm.streamsx.topology.function

## Interface FunctionContainer

-     public interface FunctionContainer

  Container for a function executing in a IBM Streams application.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.util.Map<java.lang.String,java.lang.String>` | `getApplicationConfiguration(java.lang.String name)` Get the application configuration specified by name.
    `java.net.InetAddress` | `getConfiguredHost()` Get the host this container is executing on.
    `java.lang.String` | `getDomainId()` Return the IBM Streams domain identifier for this container.
    `java.lang.String` | `getId()` Get the runtime identifier for this container.
    `java.lang.String` | `getInstanceId()` Return the IBM Streams instance identifier for this container.
    `java.lang.String` | `getJobId()` Get the runtime identifier for this container's running job.
    `java.lang.String` | `getJobName()` Return the name of this job.
    `int` | `getRelaunchCount()` Return the number of times this container has been relaunched.

- - ### Method Detail

    - #### getJobId

          java.lang.String getJobId()

      Get the runtime identifier for this container's running job. In distributed mode the identifier will be job identifier of the submitted application. When not in distributed mode the identifier is `0`.
      Returns:
        The job identifier for the current application.

    - #### getId

          java.lang.String getId()

      Get the runtime identifier for this container. In distributed mode the identifier will be processing element (PE) identifier of the process executing the function. When not in distributed mode the identifier is `0`.
      Returns:
        The identifier for this container.

    - #### getDomainId

          java.lang.String getDomainId()

      Return the IBM Streams domain identifier for this container. In distributed mode the domain identifier will be that of the IBM Streams domain running the application. When not in distributed mode this will be the current operating system user identifier.
      Returns:
        Domain identifier for this container or the user identifier.

    - #### getInstanceId

          java.lang.String getInstanceId()

      Return the IBM Streams instance identifier for this container. In distributed mode the instance identifier will be that of the IBM Streams instance running the application. When not in distributed mode this will be the current operating system user identifier.
      Returns:
        Instance identifier for this container or the user identifier.

    - #### getRelaunchCount

          int getRelaunchCount()

      Return the number of times this container has been relaunched. For the first execution, the value will be 0.
      Returns:
        number of times this container has been relaunched.

    - #### getConfiguredHost

          java.net.InetAddress getConfiguredHost()
                                          throws java.net.UnknownHostException

      Get the host this container is executing on.

      When running in distributed mode this returns the `InetAddress` for the interface configured for application use by the IBM Streams instance. This may differ from from `java.net.InetAddress.getLocalHost()` if there are multiple network interfaces on this host.

      When not running in distributed, this returns `java.net.InetAddress.getLocalHost()`.

      Returns:
        Host this container is executing on
      Throws:
        `java.net.UnknownHostException`

    - #### getApplicationConfiguration

          java.util.Map<java.lang.String,java.lang.String> getApplicationConfiguration(java.lang.String name)

      Get the application configuration specified by name.
      A secure application configuration is defined for a Streams domain or instance and contains a set of key-value properties. Typically they are used to store credentials that applications need to use to access external systems or other configuration items for an application, such as a threshold value.
      Application configuration objects are stored in Apache ZooKeeper in an encoded state.

      An empty map is returned if the configuration is not found, the application is running embedded or standalone, or a distributed instance is running a Streams install older than 4.2.

      Parameters:
        `name` - Name of the application configuration.
      Returns:
        A read-only map containing the named application configuration.
      Since:
        1.7

    - #### getJobName

          java.lang.String getJobName()

      Return the name of this job.
      Returns:
        name for the job the PE is running in
      Since:
        1.7