TStream.Routing (Java Application API for IBM Streams)
Date: 2020-08-07

com.ibm.streamsx.topology

## Enum TStream.Routing

- java.lang.Object
- - java.lang.Enum<TStream.Routing>
  - - com.ibm.streamsx.topology.TStream.Routing

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

      public static enum TStream.Routing
      extends java.lang.Enum<TStream.Routing>

  Enumeration for routing tuples to parallel channels.
  See Also:
    `TStream.parallel(Supplier, Routing)`

- - ### Enum Constant Summary

    Enum Constants
    Enum Constant and Description
    `BROADCAST` Tuples are broadcast to all channels.
    `HASH_PARTITIONED` Tuples will be consistently routed to the same channel based upon their `hashCode()`.
    `KEY_PARTITIONED` Tuples will be consistently routed to the same channel based upon their key.
    `ROUND_ROBIN` Tuples will be routed to parallel channels such that an even distribution is maintained.

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static TStream.Routing` | `valueOf(java.lang.String name)` Returns the enum constant of this type with the specified name.
    `static TStream.Routing[]` | `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

    - #### ROUND_ROBIN

          public static final TStream.Routing ROUND_ROBIN

      Tuples will be routed to parallel channels such that an even distribution is maintained.

    - #### KEY_PARTITIONED

          public static final TStream.Routing KEY_PARTITIONED

      Tuples will be consistently routed to the same channel based upon their key. The key is obtained through:
      - A function called against each tuple when using `TStream.parallel(Supplier, Function)`
      - The `identity function` when using `TStream.parallel(Supplier, Routing)`
      The key for a `t` is the return from `keyer.apply(t)`.
      Any two tuples `t1` and `t2` will appear on the same channel if for their keys `k1` and `k2` `k1.equals(k2)` is true.
      If `k1` and `k2` are not equal then there is no guarantee about which channels `t1` and `t2` will appear on, they may end up on the same or different channels.
      The assumption is made that the key classes correctly implement the contract for `equals` and `hashCode()`.

    - #### HASH_PARTITIONED

          public static final TStream.Routing HASH_PARTITIONED

      Tuples will be consistently routed to the same channel based upon their `hashCode()`.

    - #### BROADCAST

          public static final TStream.Routing BROADCAST

      Tuples are broadcast to all channels. For example with a width of four each tuple on the stream results in four tuples, one per channel.
      Since:
        1.9

  - ### Method Detail

    - #### values

          public static TStream.Routing[] 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 (TStream.Routing c : TStream.Routing.values())
              System.out.println(c);

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

    - #### valueOf

          public static TStream.Routing 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