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>
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 theirhashCode()
.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.
-
-
-
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 usingTStream.parallel(Supplier, Routing)
t
is the return fromkeyer.apply(t)
.
Any two tuplest1
andt2
will appear on the same channel if for their keysk1
andk2
k1.equals(k2)
is true.
Ifk1
andk2
are not equal then there is no guarantee about which channelst1
andt2
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 forequals
andhashCode()
. - A function called against each tuple when using
-
HASH_PARTITIONED
public static final TStream.Routing HASH_PARTITIONED
Tuples will be consistently routed to the same channel based upon theirhashCode()
.
-
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 namejava.lang.NullPointerException
- if the argument is null
-
-