Apama Documentation : Developing Apama Applications : Developing Correlator Plug-ins : Writing a Plug-in in C or C++ : Calling the test function from EPL
Calling the test function from EPL
Compiling simple_plugin.cpp produces the plug-in file libsimple_plugin.so (on UNIX) or simple_plugin.dll (on Windows).
Note:  
The plug-in needs to be placed in a location where it can be picked up by the event correlator.
This means that on Windows you either need to copy the .dll into the lib sub-directory of your Apama work directory, or else place it somewhere which is on your path, that is, a location that is referenced by the PATH environment variable.
On Linux or Solaris, you either need to copy the .so into the lib sub-directory of your Apama work directory, or else place it somewhere which is on your library path, that is, a directory that is referenced by the LD_LIBRARY_PATH environment variable.
The next step is to write some EPL code that imports the simple_plugin plug-in and calls the method test.
Some example EPL code to achieve this is as follows:

monitor SimplePluginTest {
 
  // Load the plugin
  import "simple_plugin" as simple;
 
  // To hold the return value
  string ret;
  string arg;
  action onload() {
 
    // Call plugin function
    arg := "Hello, Simple Plugin";
    ret := simple.test(arg);
 
    // Print out return value
    log "simple.test = " + ret;
    log "arg = " + arg;
  }
}
Firstly, simple_plugin must effectively be located and loaded. This is the first purpose of the import statement. Secondly, it must be assigned an alias name, in this case simple.
This then allows the plug-in's test method to be invoked as simple.test(), taking an EPL string as parameter, and returning an EPL code string as its result.
The above EPL code is provided as simple_plugin.mon in the Apama installation's samples\correlator_plugin\cpp directory.
Copyright © 2013-2016 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback