Apama  9.10.0.4.289795
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
com::softwareag::connectivity::AbstractSimpleCodec Class Referenceabstract

Helper derivative of AbstractCodec implementing message-by-message transformation. More...

#include <sag_connectivity_plugins.hpp>

Inheritance diagram for com::softwareag::connectivity::AbstractSimpleCodec:
com::softwareag::connectivity::AbstractCodec com::softwareag::connectivity::Plugin com::softwareag::connectivity::HostSide com::softwareag::connectivity::TransportSide

Public Member Functions

 AbstractSimpleCodec (const std::string &name, const std::string &chainId, const map_t &config)
 Give the plugin instance name and the chain name. More...
 
virtual void sendBatchTowardsHost (Message *start, Message *end)
 Implements batch sending, calling transformMessageTowardsHost for each message individually. More...
 
virtual void sendBatchTowardsTransport (Message *start, Message *end)
 Implements batch sending, calling transformMessageTowardsTransport for each message individually. More...
 
virtual bool transformMessageTowardsHost (Message &msg)=0
 Transform an individual message in a host-wards direction Return true to keep the message and false (or throw) to delete it. More...
 
virtual bool transformMessageTowardsTransport (Message &msg)=0
 Transform an individual message in a transport-wards direction Return true to keep the message and false (or throw) to delete it. More...
 
virtual bool transformNullPayloadTowardsHost (Message &msg)
 Transform a message with a null payload in a host-wards direction. More...
 
virtual bool transformNullPayloadTowardsTransport (Message &msg)
 Transform a message with a null payload in a transport-wards direction. More...
 
virtual bool handleException (Message &m, bool towardsTransport)
 Handle an exception thrown while delivering a message. More...
 
- Public Member Functions inherited from com::softwareag::connectivity::AbstractCodec
 AbstractCodec (const std::string &name, const std::string &chainId, const map_t &config)
 Give the plugin instance name and the chain name. More...
 
virtual void setNextTowardsHost (HostSide::ptr_t &&host)
 Set the next in the chain towards the host. More...
 
virtual void setNextTowardsTransport (TransportSide::ptr_t &&transport)
 Set the next in the chain towards the transport. More...
 
- Public Member Functions inherited from com::softwareag::connectivity::Plugin
 Plugin (const std::string &name, const std::string &chainId, const map_t &config)
 Give the plugin instance name and the chain name. More...
 
virtual ~Plugin ()
 Virtual destructor to ensure that we can delete any part of the tree. More...
 
virtual void start ()
 Called when the plugin should be started up (after all plugins are connected together). More...
 
virtual void hostReady ()
 Called when the host indicates it is ready to start receiving input (sends will be queued until this point). More...
 
virtual void shutdown ()
 Release any resources created by the connectivity plug-in, and terminate and join any background threads. More...
 
const std::string & getName () const
 Return the name of this plugin instance. More...
 
- Public Member Functions inherited from com::softwareag::connectivity::HostSide
virtual ~HostSide ()
 Ensure virtual destruction. More...
 
- Public Member Functions inherited from com::softwareag::connectivity::TransportSide
virtual ~TransportSide ()
 Ensure virtual destruction. More...
 

Additional Inherited Members

- Public Types inherited from com::softwareag::connectivity::HostSide
typedef std::auto_ptr< HostSideptr_t
 Pointers to HostSides should always be this ptr_t type, which is a std::auto_ptr. More...
 
- Public Types inherited from com::softwareag::connectivity::TransportSide
typedef std::auto_ptr
< TransportSide
ptr_t
 Pointers to TransportSides should always be this ptr_t type, which is a std::auto_ptr. More...
 

Detailed Description

Helper derivative of AbstractCodec implementing message-by-message transformation.

Handles batches of messages and ignoring null payload messages (by default). Implementors will typically sub-class this class, providing an implementation of the transformMessageTowardsHost(Message) and transformMessageTowardsTransport(Message) methods.

If you don't need to handle events a batch at a time, then you should derive from this class. If you do then you should directly derive from AbstractCodec.

Constructor & Destructor Documentation

com::softwareag::connectivity::AbstractSimpleCodec::AbstractSimpleCodec ( const std::string &  name,
const std::string &  chainId,
const map_t config 
)
inline

Give the plugin instance name and the chain name.

Member Function Documentation

virtual bool com::softwareag::connectivity::AbstractSimpleCodec::handleException ( Message m,
bool  towardsTransport 
)
inlinevirtual

Handle an exception thrown while delivering a message.

Default is to log a warning and discard a message.

towardsTransport is set to true if it was transformMessageTowardsTransport that threw or false if it was transformMessageTowardsHost that threw.

The Message that caused the error is passed in by reference. If you wish to fix the message and then continue passing it on then handleException should return true. If it should be discarded then handleException should return false;

This is called from within a catch block, so if you need to know the exception thrown then you can rethrow it yourself:

try { throw; } catch (const type &ex) { }

virtual void com::softwareag::connectivity::AbstractSimpleCodec::sendBatchTowardsHost ( Message start,
Message end 
)
inlinevirtual

Implements batch sending, calling transformMessageTowardsHost for each message individually.

Exceptions from transformMessageTowardsHost are caught and handleException is called (default is to log a warning and discard the event) If handleException or transformMessageTowardsHost returns false then that event is removed, but processing continues for the next message.

Implements com::softwareag::connectivity::HostSide.

virtual void com::softwareag::connectivity::AbstractSimpleCodec::sendBatchTowardsTransport ( Message start,
Message end 
)
inlinevirtual

Implements batch sending, calling transformMessageTowardsTransport for each message individually.

Exceptions from transformMessageTowardsTransport are caught and handleException is called (default is to log a warning and discard the event) If handleException or transformMessageTowardsTransport returns false then that event is removed, but processing continues for the next message.

Implements com::softwareag::connectivity::TransportSide.

virtual bool com::softwareag::connectivity::AbstractSimpleCodec::transformMessageTowardsHost ( Message msg)
pure virtual

Transform an individual message in a host-wards direction Return true to keep the message and false (or throw) to delete it.

virtual bool com::softwareag::connectivity::AbstractSimpleCodec::transformMessageTowardsTransport ( Message msg)
pure virtual

Transform an individual message in a transport-wards direction Return true to keep the message and false (or throw) to delete it.

virtual bool com::softwareag::connectivity::AbstractSimpleCodec::transformNullPayloadTowardsHost ( Message msg)
inlinevirtual

Transform a message with a null payload in a host-wards direction.

default is to do nothing Return true to keep the message and false (or throw) to delete it

virtual bool com::softwareag::connectivity::AbstractSimpleCodec::transformNullPayloadTowardsTransport ( Message msg)
inlinevirtual

Transform a message with a null payload in a transport-wards direction.

default is to do nothing Return true to keep the message and false (or throw) to delete it


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