Apama 10.3 | Apama Documentation | Developing Apama Applications | Developing EPL Plug-ins | EPL Plug-ins in C and C++ Written Prior to 10.0 | Migrating from 9.12 or older plug-ins
Migrating from 9.12 or older plug-ins
To migrate an existing plug-in that has been created with version 9.12 or earlier, you will need to follow the steps below. The two APIs are quite different, but you will find the implementation overall simpler and easier to manage.
1. Include epl_plugin.hpp instead of correlator_plugin.hpp.
#include <epl_plugin.hpp>
2. Import the com::apama::epl namespace.
using namespace com::apama::epl;
3. Define a class which inherits from EPLPlugin. This will hold all the methods which are exported to EPL. Previously, these could have been free functions or static member functions. Now they are non-static member functions.
class MyPlugin: public EPLPlugin<MyPlugin>
4. Add a zero-argument constructor.
MyPlugin(): base_plugin_t("MyPlugin") {}
5. Change all your exported methods to be members of your class and change the void(const AP_Contex &, const AP_TypeList &, AP_Type &, AP_TypeDiscriminator) signature to be the actual C++ types that your method will take and return. You will no longer need to unpack the typelist argument or explicitly set the return value, you can just read the arguments and return directly.
void myMethod(int64_t arg1)
bool anotherMethod(double arg1, double arg2)
return arg1 < arg2;
6. Change use of functions on the AP_Context argument to functions to use the getCorrelator() static method instead.
7. Replace the AP_Function array, type signatures and version declaration from the AP_INIT_FUNCTION_NAME free function with an initialize() static function on your class.
static void initialize(base_plugin_t::method_data_t &md)
8. Other code from AP_INIT_FUNCTION_NAME goes in your constructor.
9. Code from AP_SHUTDOWN_FUNCTION_NAME goes in your destructor.
11. Add a call to APAMA_DECLARE_EPL_PLUGIN for your class.
12. If you use chunks, you no longer need to inherit from a particular class, just declare methods which return custom_t<T>, where T is the type you want to store in EPL.
struct MyChunkType
int64_t datum;
custom_t<MyChunkType> createChunk(int64_t datum)
return custom_t<MyChunkType>(new MyChunkType{datum});
int64_t getChunkValue(const custom_t<MyChunkType> &chunk)
return chunk->datum;

Copyright © 2013-2018 | 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.