Custom Java Operators may be shared in two supported ways:
A. using an EventFlow fragment project each user loads into their Studio workspace and uses through a
pom.xml dependency.
B. using a Maven Java project the user's EventFlow (EF) or Live Datamart (LDM) project uses through a
pom.xml dependency.
A. As an EventFlow Fragment Project
In an EventFlow fragment project, use the New > StreamBase Java Operator wizard to create the operator
.java and
BeanInfo.java files and edit normally to add functionality. Then in the user EF or LDM project, add the dependency to the
pom.xml in the <dependencies> section (example):
<dependencies>
<dependency>
<groupId>com.example</groupId>
<artifactId>myoperators</artifactId>
<type>ep-eventflow-fragment</type>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
Since the project supplying the custom java operators are present in the workspace, use from the Palette-view "Adapters, Java Operators" dialog, typechecking, and setting element StreamBase Properties all work as expected without additional configuration. Note that if the EventFlow fragment implementing the custom Java operators is closed or removed from the workspace then Studio will use the Maven Repository build of the supplying project, but lacks access to the custom operator properties for configuration.
B. As a Maven Java Project
This allows the custom operator to be used from the Maven Repository, just like the product Java operators, without needing their sources to be in an open project in the Eclipse workspace.
In an EventFlow fragment project, use the
New > StreamBase Java Operator wizard to create the operator
.java and
BeanInfo.java files and edit normally to add functionality.
Then create a new Maven Project. Add an appropriate package (e.g.
com.mycompany.org.sb.utilities). Copy the
.java and
BeanInfo.java files for each custom operator from the EventFlow fragment project into the Java package. The "package" statement will be updated automatically in Eclipse.
Edit the Maven project
pom.xml to make sure the packaging is "
jar", e.g. "
<packaging>jar</packaging>".
Add to the
pom.xml the dependencies for Streaming Java Operators:
<dependencies>
<dependency>
<groupId>com.tibco.ep.sb</groupId>
<artifactId>client-core</artifactId>
<version>11.1.0</version>
</dependency>
<dependency>
<groupId>com.tibco.ep.sb</groupId>
<artifactId>server</artifactId>
<version>11.1.0</version>
</dependency>
</dependencies>
Add to the
pom.xml the build
MANIFEST.MF settings (example, replace
PassThru with the name of your class):
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<archive>
<manifestSections>
<manifestSection>
<name>com/example/myoperators/PassThru.class</name>
<manifestEntries>
<StreamBase-Operator>True</StreamBase-Operator>
</manifestEntries>
</manifestSection>
</manifestSections>
</archive>
</configuration>
</plugin>
</plugins>
</build>
Additional <manifestSection> sections are needed for each class to be presented as a Streaming Operator.
On the Java project perform:
Run As > Maven build…, with targets "
clean install". This places the operator jar into the local Maven Repository. This allows your Streaming custom Java operator to be deployed the same way as any of the product built-in Java operators.
Finally, in the user EventFlow or Live Datamart project, add the dependency to the
pom.xml in the <dependencies> section (example):
<dependencies>
<dependency>
<groupId>com.example</groupId>
<artifactId>myoperators</artifactId>
<type>jar</type>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
Optionally, the full set of build settings available for a Streaming Operator are:
<manifestEntries>
<StreamBase-Operator>True</StreamBase-Operator>
<Display-Name>Pass Through Operator</Display-Name>
<Short-Display-Name>PassThru</Short-Display-Name>
<Canvas-Icon>/com/example/myoperators/PassThru-48x48.png</Canvas-Icon>
<Large-Icon>/com/example/myoperators/PassThru-32x32.png</Large-Icon>
<Small-Icon>/com/example/myoperators/PassThru-16x16.png</Small-Icon>
</manifestEntries>
Troubleshooting
If in Studio the custom Java operator does not typecheck, the class is not found, or the
StreamBase Properties view does not populate fully, doublecheck the EventFlow project's
pom.xml dependency and that the jar is at the expected location in the local Maven Repository (e.g.
C:\Users\Me\.m2\repository, or where specified in the
.m2/settings.xml file if it exists).
Use the right-click action on the EventFlow project:
Maven > Update Project, with "
Force Update of Snapshots/Releases" enabled.
Monitor build actions using the Eclipse "
Progress" view to ensure all build and typechecking actions have completed before trying to correct an error.