IBM Streams 4.2

Types of operators

When developing new operators, developers need to choose the kind of operator to implement based on the task they want to accomplish, the programming language they want to use and the trade-offs they are willing to make between generality and ease of implementation.

Streams Processing Language (SPL) programmers can write many useful streaming applications without implementing their own operators. Developers can build applications by assembling operators only from the SPL Standard Toolkit or other available toolkits. However, SPL programmers eventually might want an operator to perform new functions. Implementing a new operator is different from connecting existing operators.

When you choose the type of operator to implement, you must consider whether ease of development or implementation power is more important. Implementing operators purely in SPL (Custom or composite operators) is easier because less friction is caused by shifting between different languages. However, the capabilities of the operators that programmers can implement in SPL are more limited. Choosing to implement an operator in a lower-level language such as C++ or Java™ (primitive operators) might be more appropriate. The taxonomy of operators is represented in the following figure, and is oriented by operator relationships.

Figure 1. Types of operators.
The Java box branches downward to two boxes titled JavaOp and primitive.
Developers can choose what type of operator to implement based on required function. Some tasks might allow a choice of operators, while other tasks require that you use a specific operator. The following table presents the operator types that are based on their capabilities, and can help developers choose which operator to implement. In the table:
  • The Custom row refers to using a Custom operator by itself.
  • The Composite and custom row refers to the technique of wrapping a Custom operator inside of a composite operator.
Operator type Languages Must define operator model Is input/output port generic Can use generated APIs Can receive expressions as parameters Reusable
Generic C++, Perl yes yes no yes yes
Non-generic C++ yes yes yes no yes
Java primitive Java yes yes no no yes
JavaOp Java no yes yes (with generated option; still uses reflection) no yes
Custom SPL no no n/a no no
Composite and custom SPL no no n/a yes yes