Developing Apama Applications > Writing Correlator Plug-ins > Writing Correlator Plug-ins in Java > Creating a plug-in using Java
Creating a plug-in using Java
To create a Java class to use as a correlator plug-in:
1. In the Java class used as a plug-in, you need to have one or more public static methods that match the permitted signatures, which are described in Permitted signatures for methods.
All calls from an Apama application will be made to these static methods from all contexts.
As the plug-in author you are responsible for any concurrency concerns.
2. Correlator plug-ins in Java are deployed using a JMon application and are packaged in a jar file. You need to create a JMon deployment descriptor file in the application's META-INF/jmon-jar.xml file. For the plug-in you need to add a <plugin> to the <application-classes> element.
For more information on Apama deployment descriptor files, see Creating deployment descriptor files in Developing Apama Applications in Java.
An example plug-in stanza looks like this:
<plugin>
<plugin-name>TestPlugin</plugin-name>
<plugin-class>test.TestPlugin</plugin-class>
<description>A test plugin</description>
</plugin>
*plugin-name defines the name visible to EPL.
*plugin-class indicates the class to load from the jar for this plugin.
*description is a simple textual description that appears in log messages.
Instead of writing a deployment descriptor file manually, if you are using Apama Studio to create the plug-in you can annotate the plug-in class and have Studio automatically generate the descriptor file. Here is an example annotation:
@com.apama.epl.plugin.annotation.EPLPlugin(name="TestPlugin",
description="A test plugin")
class testplugin
{
...

}
3. Create a jar file for deploying the plug-in and add the Java class file and the deployment descriptor file META-INF/jmon-jar.xml to it. In Apama Studio when you create a JMon application, this is done automatically.
For applications that you plan to inject into a correlator, the recommendation is to create separate jar files for:
*Correlator plug-ins written in Java
*JMon applications
Although the mechanism for creating these jars and describing their meta-data is similar, the interactions of these two different uses of injected jars mean that they will often need to be injected into the correlator separately. The creation of separate jar files ensures that you can inject your application components in the correct order, which is typically:
1. Correlator plug-ins written in Java
2. EPL monitors and events
3. JMon applications
Copyright © Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its Subsidiaries and or/its Affiliates and/or their licensors.
Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG.