Dispatch Styles

Tuples are routed through an operator or module in roughly first-come, first-served order. See Rules of StreamBase Execution Order for a more complete discussion of the rules.

But when there is more than one instance of the same operator or module, in what order are tuples routed to each instance? This question arises in the following cases:

  • When a single operator or module specifies a multiplicity setting of two or more, which causes the specified number of instances of the operator or module to run in parallel.

  • When an Extension Point operator hosts two or more instances of modules that implement the interface referenced by that Extension Point.

In these cases, StreamBase's default behavior, called Broadcast, is to send incoming tuples equally to each instance of the operator or module in parallel. You can optionally specify non-default styles for dispatching incoming tuples to operator or module instances.

For certain cases, the tuple dispatch style can be set independently for each input stream. This applies to:

  • Module References where the referenced module has more than one input stream.

  • Extension Points.

  • Operators with more than one input stream, including Join, Gather, Merge, and Pattern.

StreamBase offers the following dispatch styles for routing tuples to multiple operator or module instances:

Broadcast

Broadcast is the default dispatch style for both EventFlow and StreamSQL applications. This style sends incoming tuples in parallel to all operator or module instances that are running in parallel.

Numeric

Specify the Numeric dispatch style for multiple instances of operators and modules, but not for Extension Point modules. This style routes incoming tuples to one of several parallel operator or module instances, based on a match between incoming field data and an expression that resolves to a number. Your application places logic in upstream components that determines the numeric value of a field or combination of fields in each tuple. When you specify the Numeric dispatch style, you must also specify a Dispatch Expression that resolves to an int. (Use the hash() function to turn other types of expressions into integers.) The expression is divided by the number of instances, and the remainder determines which instance the tuple goes to.

(In previous StreamBase releases, the Numeric dispatch style was the only dispatch method you could explicitly specify as part of the data parallelism options in the Concurrency tab of the Properties view.)

Round Robin

Specify the Round Robin dispatch style for multiple instances of operators and modules, but not for Extension Point modules. This style routes incoming tuples automatically to each instance of a parallel operator or module in turn. The first tuple goes to the first operator or module instance. The next tuple is routed to the next operator or module instance in the list, and so on in round robin sequence among all multiple instances.

(In previous StreamBase releases, the Round Robin dispatch style was the default if you did not specify a key expression as part of the data parallelism options in the Concurrency tab of the Properties view.)

Name

Specify the Name dispatch style only for module instances of an Extension Point operator. Module instances of an Extension Point are each assigned a module identifier in one of two places:

  • In the Name column of the Modules tab of the Extension Point operator's Properties view.

  • In the name attribute of an <extension> element in a StreamBase deployment file.

The Name dispatch style routes incoming tuples to one of the Extension Point's module instances by module identifier, using logic in upstream components before entering the operator to determine and specify the module identifier to call. When you specify the Name dispatch style, you must also specify a Dispatch Expression that resolves to one of the module identifiers on the Modules tab or in a StreamBase deployment file.

Back to Top ^