An adapter may be shared with other projects from its project in the same workspace, or as a JAR file from a Maven Repository.
Once you have created your adapter in an EventFlow fragment project...
A. Use with the custom adapter project in your workspace:
1. Have the project that contains the custom adapter Open.2. Add a dependency to this project from the project which will use the adapter.Note: You may need to build the custom adapter project with 'install' target to make the adapter visible.
The custom adapter will then appear normally in the Adapter dialog opened from the Palette.
B. Use as a JAR file:
This adds the necessary MANIFEST record so that StreamBase recognizes the class in the JAR as an adapter.
1. Modify the custom adapter project's POM.Modify the custom adapter project POM to have:
<packaging>jar</packaging>instead of "<packaging>ep-eventflow-fragment</packaging>". This changes the build to create a JAR file instead of a fragment ZIP file.
Add to the POM:
<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/customadapters/MyCustomAdapter.class</name>
<manifestEntries>
<StreamBase-Adapter>True</StreamBase-Adapter>
</manifestEntries>
</manifestSection>
</manifestSections>
</archive>
</configuration>
</plugin>
</plugins>
</build>
And change these settings:
a. Change the
<name> to the correct package and classname for your adapter.
b. Check the maven-jar-plugin plugin
<version> value and change it to match your environment.
2. Build the project with 'install' target to put the jar into the local Maven Repository.Note: This includes in the jar file any .sbapp files from EventFlow packages, so to exclude these these must be removed from the project before building.
3. In the project needing the adapter, add a dependency to the 'jar' instead of to the 'ep-eventflow-fragment', save the POM, and run Maven > Update on the project.Note: If using a new workspace, before adding the dependency to the POM, open view
Maven > Repositories, expand Local Repository, and run
Rebuild Index.