Apama
10.2.0.3
|
Base class for transport plug-ins. More...
#include <sag_connectivity_plugins.hpp>
Public Member Functions | |
AbstractTransport (const std::string &name, const std::string &chainId, const map_t &config) | |
Legacy constructor [DEPRECATED]. More... | |
AbstractTransport (const PluginConstructorParameters::TransportConstructorParameters ¶ms) | |
Constructor. More... | |
Public Member Functions inherited from com::softwareag::connectivity::Plugin | |
Plugin (const std::string &pluginName, const std::string &chainId, const map_t &config) | |
Legacy constructor [DEPRECATED]. More... | |
virtual | ~Plugin () |
This destructor must be virtual. More... | |
virtual void | start () |
Called when an entire chain has been created and the plugin is allowed to start up (after all plugins are connected together). More... | |
virtual void | hostReady () |
Called some time after start(), when the host is ready to start receiving input (sends will be queued until this point). More... | |
virtual void | shutdown () |
Stop processing messages and terminate and join any background threads. More... | |
const std::string & | getName () const |
The name used for this plug-in in the configuration file. More... | |
Public Member Functions inherited from com::softwareag::connectivity::TransportSide | |
virtual | ~TransportSide () |
Ensure virtual destruction. More... | |
virtual void | sendBatchTowardsTransport (Message *start, Message *end)=0 |
Abstract method that must be implemented to handle delivery of a batch of messages heading towards the transport. More... | |
void | sendBatchTowardsTransport (Message &&message) |
Overload for sending a batch containing a single message. More... | |
template<typename IT > | |
auto | sendBatchTowardsTransport (const IT &begin, const IT &end) -> typename std::enable_if< !std::is_const< ampl::remove_ref_t< decltype(*begin)>>::value &&l::is_same< Message, ampl::remove_const_t< ampl::remove_ref_t< decltype(*begin)>>>::value, void >::type |
Overload for sending messages using an iterator range. More... | |
Protected Attributes | |
HostSide::ptr_t | hostSide |
The next plug-in in the chain towards host. More... | |
Protected Attributes inherited from com::softwareag::connectivity::Plugin | |
const std::string | name |
The name used for this plug-in in the configuration file. More... | |
const std::string | pluginName |
The name used for this plug-in in the configuration file. More... | |
const std::string | chainId |
The identifier used for the chain this plug-in is part of. More... | |
map_t | config |
The configuration of this plug-in. More... | |
const PluginHost::ptr_t | host |
Interface to support miscellaneous requests from this plug-in to the host system. More... | |
Additional Inherited Members | |
Public Types inherited from com::softwareag::connectivity::TransportSide | |
typedef std::unique_ptr < TransportSide > | ptr_t |
Pointers to TransportSides should always be this ptr_t type, which is a std::unique_ptr. More... | |
Public Attributes inherited from com::softwareag::connectivity::Plugin | |
Logger | LOGGER |
Legacy logging for writing to the host log file [DEPRECATED]. More... | |
Logger | logger |
Logging for writing to the host log file. More... | |
Protected Member Functions inherited from com::softwareag::connectivity::Plugin | |
StatusReporter & | getStatusReporter () |
Allows reporting status information from this plug-in, such as online or failed status and number of messages sent/received in each direction. More... | |
Base class for transport plug-ins.
Implementors may derive directly from this class if you need to handle messages in batches, typically by providing an implementation of sendBatchTowardsTransport(Message*,Message*), and in the other direction sending messages towards the host from a background thread created by the start() method. Messages are delivered to or from this class in batches, which transports may be able to make use of to deliver many messages in a single operation, amortizing the cost of delivering messages. The division into batches is of no significance beyond them all being available for delivery within a short space of time - a transport should function the same if given the messages individually or in batches.
For many transport plug-ins, inheriting from AbstractSimpleTransport may be more convenient than using this class directly, as it deals with batching of messages automatically.
To export a transport class for use in the host you should use the SAG_DECLARE_CONNECTIVITY_TRANSPORT_CLASS(Class) macro, and provide a public constructor with the same signature as AbstractTransport(const PluginConstructorParameters::TransportConstructorParameters ¶ms)
The deprecated legacy constructor AbstractTransport(const std::string &name, const std::string &chainId, const map_t &config) and SAG_DECLARE_CONNECTIVITY_TRANSPORT(Class) macro are still permitted as an alternative but should not be used for new plug-ins.
Derives from Plugin, which provides Plugin::pluginName, Plugin::chainId, Plugin::config and Plugin::logger members. Derives from TransportSide, requiring derived classes to implement sendBatchTowardsTransport(Message*, Message*)
Note: Some transports may need to respond to every message received from the host with a corresponding reply back towards the host. This has to be done carefully; if the implementation of TransportSide.sendBatchTowardsTransport() contains a simple synchronous call back to HostSide.sendBatchTowardsHost(), this has the potential to cause a deadlock in the host application, depending on the disposition of internal queues. Transports needing to follow this pattern should generate their responses on a distinct thread, not the thread that processes the message(s) from the host.
|
inline |
Legacy constructor [DEPRECATED].
A plug-in should throw an exception from the constructor if there is a problem with the configuration or any other error that will prevent the plug-in from working correctly.
name | The name used in the configuration file for this plug-in. |
chainId | The identifier used for the chain this plug-in is part of. |
config | The configuration for this plug-in. |
|
inline |
Constructor.
A subclass should provide its own constructor with the same signature as this one.
A plug-in should throw an exception from the constructor if there is a problem with the configuration or any other error that will prevent the plug-in from working correctly.
params | Provides access to the configuration for this plug-in, and other capabilities. |
|
protected |
The next plug-in in the chain towards host.
This field will be given a valid value before the start() method is called.