Apama Documentation : Developing Apama Applications : Developing Apama Applications in EPL : Using Correlator Plug-ins in EPL : Interfacing with user-defined correlator plug-ins
Interfacing with user-defined correlator plug-ins
Although EPL is very powerful and enables complex applications, it is foreseeable that some applications might require additional specialized operations. For example, an application might need to carry out advanced arithmetic operations that are not provided in EPL.
A developer can address this situation by writing custom correlator plug-ins using Apama's C and C++ Plug-In Development Kits. A plug-in consists of an appropriately formatted library of C or C++ functions which can be called from within EPL while Apama is executing monitors. Apama and its event correlator components do not need to be modified to enable or to integrate with a plug-in, as the plug-in loading process is transparent and occurs dynamically when required.
Once a plug-in is developed, a developer can call the functions it contains directly from a monitor in EPL, passing EPL variables and constants as parameters, and getting return values that can be manipulated. For information on developing your custom event correlator plug-in, see Developing Correlator Plug-ins.
Note:  
The correlator's plug-in interface is versioned. For a correlator plug-in to be compatible with an event correlator they both need to support the same plug-in interface version. See Developing Correlator Plug-ins for information about how to ensure that your correlator plug-in is compatible with the event correlator it will run in.
In order to access a function implemented in an event correlator plug-in, the developer must first import the plug-in, for example:
import "apama_math" as math;
This will look for Apama Plug-in file libapama_math.so (on Solaris or Linux) or for apama_math.dll (on Windows). These must be located on the standard library path (in LD_LIBRARY_PATH in Unix, and in the bin folder on Windows). It will then map it to the internal alias math.
Note:  
Insert the import statement in the monitor that uses the plug-in functions.
If the apama_math plug-in defines a method in C or C++ called cos that takes a single floating point value as an argument and returns a float value, this would be called from EPL as follows:
float a, b;
// ... some other EPL
a := math.cos(b);
Standard float, integer and boolean types are passed by-value to external functions while string types and sequences (which map to native arrays in the plug-in) are passed by-reference. In addition, the chunk type can be used to ‘pass-through' data returned from one function call to another plug-in function, as shown below.
Copyright © 2013-2016 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback