IBM Streams 4.3.0

Creating Java native functions

Java™ native functions can be invoked from SPL by using the same syntax that is used for an SPL function.

You create Java native functions by adding Java annotations that describe Java public static methods as native functions to the SPL compiler. For more information about creating a Java native function, see the API documentation for the com.ibm.streams.function.model package.

To create a Java native function that can be called from an application that you create by using Streams Studio, the typical high-level steps are:
  1. Annotate a public static Java method by adding the @Function annotation.
  2. Optionally, annotate the containing class by adding the @ToolkitLibraries annotation.
  3. Compile the Java class that contains the method.
  4. Package the class and its nested classes in a .jar file in the lib or impl/lib subdirectory of the toolkit directory.
  5. Build the SPL project that contains the annotated Java method. When the project is built, it generates the SPL artifacts that are necessary to call the Java method from an SPL operator.
  6. Edit the operator to call the Java method that you added the @Function annotation to.
  7. Launch the build of the main composite that contains the operator.