Apama  10.7.2.2
com::softwareag::connectivity::AbstractTransport Class Reference

Base class for transport plug-ins. More...

#include <sag_connectivity_plugins.hpp>

Inheritance diagram for com::softwareag::connectivity::AbstractTransport:
com::softwareag::connectivity::Plugin com::softwareag::connectivity::TransportSide com::softwareag::connectivity::AbstractSimpleTransport

Public Member Functions

 AbstractTransport (const PluginConstructorParameters::TransportConstructorParameters &params)
 Constructor. More...
 
- Public Member Functions inherited from com::softwareag::connectivity::Plugin
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 &&ampl::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 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< TransportSideptr_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
 Logging for writing to the host log file. More...
 
- Protected Member Functions inherited from com::softwareag::connectivity::Plugin
StatusReportergetStatusReporter ()
 Allows reporting status information from this plug-in, such as online or failed status and number of messages sent/received in each direction. More...
 

Detailed Description

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 &params)

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.

Constructor & Destructor Documentation

◆ AbstractTransport()

com::softwareag::connectivity::AbstractTransport::AbstractTransport ( const PluginConstructorParameters::TransportConstructorParameters params)
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.

Parameters
paramsProvides access to the configuration for this plug-in, and other capabilities.
Since
9.12.0.1

Member Data Documentation

◆ hostSide

HostSide::ptr_t com::softwareag::connectivity::AbstractTransport::hostSide
protected

The next plug-in in the chain towards host.

This field will be given a valid value before the start() method is called.


The documentation for this class was generated from the following file: