IBM Streams 4.2
Using the Javaop operator
The operator spl.utility.JavaOp invokes
an operator that is implemented in Java™ by
using the Java Operator API.
It is a general-purpose callout to Java from
SPL.
The mechanism to use Java in
an SPL application is instead by a Java primitive
operator.
A Java primitive operator
has many benefits over the JavaOp operator, namely:
- The ability to specify syntactic and semantic checks for instances of the Java code when used in a streams processing application. For example, a missing parameter can be detected only at run time when you use JavaOp. Whereas, a Java primitive can find the missing parameter at SPL compile time.
- The Java primitive operator's name implies its function. For example, invocation of a Java primitive named HttpPost makes for more readable SPL code than invocation of JavaOp with a className parameter set to com.ibm.streams.operator.samples.sinks.HttpPOST, even though they both use the same Java code.
- The Java primitive operator might have an icon specific to its function for viewing graphical representations of the application.
However, spl.utility.JavaOp can be used as a development or prototyping aid to help quickly develop operators with the Java Operator API. You can understand the required parameters and libraries before you create a Java primitive operator.