Using Java Operators

This topic describes how to add a Java operator to a StreamBase application.

Prerequisite steps (described in Developing Java Operators API Guide):

  • You have created one or more custom Java operators (for example, by using the Spotfire Streaming Java Operator wizard), and edited the generated Java source to add the functionality you want, or placed a JAR file containing one or more custom Java operators in your project.

  • The StreamBase Java Client library is on your project's build path.

  • You have refreshed the project's Typecheck Environment.

Adding a Java Operator to an EventFlow Application

To add a Java operator to an EventFlow application:

  1. Open the application to which you want to add the Java operator.

  2. Open the Project Operators drawer of the Palette and find the Java operator you want to use. If you are using an operator whose files are stored outside the current project, make sure that its location is in the resource search path of the application as described in Resource Search Path.

  3. Drag the Java operator icon from the Palette into your EventFlow Editor.

  4. Connect the new Java operator instance into your application's flow, by drawing arcs from the operator ports to the appropriate components.

  5. Open the Properties view for the operator and define its properties in the tabs, as described in the remainder of this topic.

Properties: General Tab

Name: Use this required field to specify or change the name of this instance of this component. The name must be unique within the current EventFlow module. The name can contain alphanumeric characters, underscores, and escaped special characters. Special characters can be escaped as described in Identifier Naming Rules. The first character must be alphabetic or an underscore.

Operator: A read-only field that shows the formal name of the operator.

Class name: Shows the fully qualified class name that implements the functionality of this operator. If you need to reference this class name elsewhere in your application, you can right-click this field and select Copy from the context menu to place the full class name in the system clipboard.

Start with application: If this field is set to Yes (default) or to a module parameter that evaluates to true, this instance of this operator starts as part of the JVM engine that runs this EventFlow fragment. If this field is set to No or to a module parameter that evaluates to false, the operator instance is loaded with the engine, but does not start until you send an epadmin container resume command (or its sbadmin equivalent), or until you start the component with StreamBase Manager.

Enable Error Output Port: Select this checkbox to add an Error Port to this component. In the EventFlow canvas, the Error Port shows as a red output port, always the last port for the component. See Using Error Ports to learn about Error Ports.

Description: Optionally, enter text to briefly describe the purpose and function of the component. In the EventFlow Editor canvas, you can see the description by pressing Ctrl while the component's tooltip is displayed.

Properties: Operator Properties Tab

The Operator Properties tab displays the parameters that you or another developer implemented in the custom Java Operator class. For example, the Operator class may present a radio button choice for a Boolean field, a text box for a Double, a dropdown selector for an Int, a table for a String Array, and a text field for a String.

For example:

The contents and functionality of the Parameters tab are set entirely by your implementation of the Java Operator class. For implementation details, see Using the Java Operator API in the API Guide. Also refer to the com.streambase.sb.operator.* Javadoc for the StreamBase Java Client library. Also run the Java Operator sample, view the source for StringCase.java, and see the sample's documentation.

Properties: Concurrency Tab

Use the Concurrency tab to specify parallel regions for this instance of this component, or multiplicity options, or both. The Concurrency tab settings are described in Concurrency Options, and dispatch styles are described in Dispatch Styles.

Caution

Concurrency settings are not suitable for every application, and using these settings requires a thorough analysis of your application. For details, see Execution Order and Concurrency, which includes important guidelines for using the concurrency options.