Apama
10.2.0.3
|
#include <correlator_plugin.hpp>
Public Member Functions | |
virtual | ~AP_CorrelatorInterface ()=0 |
virtual void | pluginNowBlocking () const =0 |
virtual void | sendEvent (const char *event)=0 |
virtual void | sendEventTo (const char *event, AP_uint64 targetContext, AP_uint64 sourceContext)=0 |
virtual void | sendEventTo (const char *event, AP_uint64 targetContext, const AP_Context &source)=0 |
virtual void | sendEventTo (const char *event, const char *targetChannel, const AP_Context &source)=0 |
void | subscribe (const AP_EventHandlerInterface::ptr_t &handler, std::initializer_list< const char * > channels) |
template<typename ITER > | |
void | subscribe (const AP_EventHandlerInterface::ptr_t &handler, const ITER &start, const ITER &end) |
template<typename T > | |
void | subscribe (const AP_EventHandlerInterface::ptr_t &handler, const T &channel) |
void | unsubscribe (const AP_EventHandlerInterface::ptr_t &handler, std::initializer_list< const char * > channels) |
template<typename ITER > | |
void | unsubscribe (const AP_EventHandlerInterface::ptr_t &handler, const ITER &start, const ITER &end) |
template<typename T > | |
void | unsubscribe (const AP_EventHandlerInterface::ptr_t &handler, const T &channel) |
virtual void | unsubscribe (const AP_EventHandlerInterface::ptr_t &handler)=0 |
Protected Member Functions | |
virtual void | subscribe_impl (const AP_EventHandlerInterface::ptr_t &handler, char const *const *start, char const *const *end)=0 |
virtual void | unsubscribe_impl (const AP_EventHandlerInterface::ptr_t &handler, char const *const *start, char const *const *end)=0 |
template<typename ITER > | |
void | subscribe_impl (const AP_EventHandlerInterface::ptr_t &handler, const ITER &start, const ITER &end) |
template<typename ITER > | |
void | unsubscribe_impl (const AP_EventHandlerInterface::ptr_t &handler, const ITER &start, const ITER &end) |
A per-plugin instance of this class can be obtained by calling AP_Context::getCorrelator(). Methods of this class may be invoked from background threads.
|
pure virtual |
|
pure virtual |
A no-op if the plugin doesn't also declare itself as non-blocking via the AP_PLUGIN_GET_CAPABILITIES_FUNCTION_NAME. Potentially blocking operations include sendEventTo.
This form should be called if there is no AP_Context object supplied, such as in a destructor. It should only be called on the thread calling into the plugin from the correlator.
|
pure virtual |
event | the event to send. The event is represented as a string using the format described in the manual. See AP_EventWriter.h for utility code to help build valid event strings. |
|
pure virtual |
event | the event to send. The event is represented as a string using the format described in the manual. See AP_EventWriter.h for utility code to help build valid event strings. |
targetContext | the target context. |
sourceContext | the source context. Must be as returned from AP_Context.getContextId(), or 0 if called from a plugin thread. |
This function is deprecated in favour of calling sendEventTo that takes a const AP_Context&.In particular, you may not call this function from a plugin event handler and must pass in an AP_Context& to avoid deadlocks.
|
pure virtual |
event | the event to send. The event is represented as a string using the format described in the manual. See AP_EventWriter.h for utility code to help build valid event strings. |
targetContext | the target context. |
source | the source context or handler. Must be the AP_Context passed to your function, or AP_Context::NoContext() if called from a plugin thread. |
|
pure virtual |
event | the event to send. The event is represented as a string using the format described in the manual. See AP_EventWriter.h for utility code to help build valid event strings. |
targetChannel | the target channel name. |
source | the source context or handler. Must be the AP_Context passed to your function, or AP_Context::NoContext() if called from a plugin thread. |
|
inline |
If this event handler is already subscribed to one or more channels, then the channels you specify in this call are added to that subscription (quashing duplicates). Otherwise a new subscription is created for the new channels.
This method uses smart pointers for reference counting and an initializer list (C++11) so should be called like this:
correlator->subscribe(AP_EventHandlerInterface::ptr_t(new MyHandlerType()), { "channel one", "channel two" });
handler | The event handler to subscribe. |
channels | A list of the channels to subscribe to. |
|
inline |
If this event handler is already subscribed to one or more channels, then the channels you specify in this call are added to that subscription (quashing duplicates). Otherwise a new subscription is created for the new channels.
This method uses smart pointers for reference counting and an iterator pair, so should be called like this:
correlator->subscribe(AP_EventHandlerInterface::ptr_t(new MyHandlerType()), channels.begin(), channels.end());
or (with an array of char*s):
correlator->subscribe(AP_EventHandlerInterface::ptr_t(new MyHandlerType()), channels+0, channels+n);
equivalent to: for (auto it = start; it != end; ++it) { subscribe(my_handle, *it); }
The iterators must dereference to something which can be cast to a const char*
handler | The event handler to subscribe. |
start | The iterator to start from |
end | The iterator to end at |
|
inline |
If this event handler is already subscribed to one or more channels, then the channels you specify in this call are added to that subscription (quashing duplicates). Otherwise a new subscription is created for the new channels.
This method uses smart pointers for reference counting so should be called like this:
correlator->subscribe(AP_EventHandlerInterface::ptr_t(new MyHandlerType()), "channel one");
handler | The event handler to subscribe. |
channel | The channel to subscribe to (must be castable to char*). |
|
protectedpure virtual |
|
inlineprotected |
|
inline |
If this results in the handler being subscribed to no channels, then removes that subscription entirely (which may result in deleting the handler if it has no other references).
This method uses smart pointers for reference counting and an initializer list (C++11) so should be called like this:
correlator->unsubscribe(my_handler, { "channel one", "channel two" });
handler | The event handler to unsubscribe. |
channels | A list of the channels to unsubscribe from. |
|
inline |
If this results in the handler being subscribed to no channels, then removes that subscription entirely (which may result in deleting the handler if it has no other references).
This method uses smart pointers for reference counting and an iterator pair so should be called like this:
correlator->unsubscribe(my_handler, channels.begin(), channels.end());
or (with an array of char*s):
correlator->unsubscribe(my_handler, channels+0, channels+n);
equivalent to: for (auto it = start; it != end; ++it) { unsubscribe(my_handle, *it); }
The iterators must dereference to something which can be cast to a const char*
handler | The event handler to unsubscribe. |
start | The iterator to start from |
end | The iterator to end at |
|
inline |
If this results in the handler being subscribed to no channels, then removes that subscription entirely (which may result in deleting the handler if it has no other references).
This method uses smart pointers for reference counting.
handler | The event handler to unsubscribe. |
channel | The channel to unsubscribe from (must be castable to a char*) |
|
pure virtual |
This may result in deleting the handler if it has no other references.
handler | The event handler to unsubscribe. |
|
protectedpure virtual |
|
inlineprotected |