Apama  10.7.2.2
com::softwareag::connectivity::chainmanagers::ChannelLifecycleListener Class Referenceabstract

API for Chain Manager to listen for changes in channel subscriptions within the correlator. More...

#include <sag_connectivity_chain_managers.hpp>

Public Member Functions

virtual ~ChannelLifecycleListener ()
 Virtual destructor. More...
 
virtual void onChannelCreated (const std::string &channel, Direction direction)=0
 Called by host when a channel is created which starts with the prefix provided during listener registration. More...
 
virtual void onChannelDestroyed (const std::string &channel, Direction direction)=0
 Called by host when a channel is destroyed which starts with the prefix provided during listener registration. More...
 

Detailed Description

API for Chain Manager to listen for changes in channel subscriptions within the correlator.

The chain manager will need to register listeners for interested channels by using the AbstractChainManager.host.

Thread-safety: The callbacks methods can be called from multiple threads so plug-in should take care of accessing any mutable state in thread safe manner.

The hostwards channels subscriptions in persistent monitor are persisted so listener will be notified of channel creations of matching channels in HOSTWARDS direction during recovery. The transportwards channels are not persisted so listener will not receive any channel creation notification in TRANSPORTWARDS direction during recovery, instead it will be notified of a matching channel creation when first event is sent to the channel. Direction is either TOWARDS_TRANSPORT or TOWARDS_HOST.

 @since 10.2.0.0

Constructor & Destructor Documentation

◆ ~ChannelLifecycleListener()

virtual com::softwareag::connectivity::chainmanagers::ChannelLifecycleListener::~ChannelLifecycleListener ( )
inlinevirtual

Virtual destructor.

Member Function Documentation

◆ onChannelCreated()

virtual void com::softwareag::connectivity::chainmanagers::ChannelLifecycleListener::onChannelCreated ( const std::string &  channel,
Direction  direction 
)
pure virtual

Called by host when a channel is created which starts with the prefix provided during listener registration.

This method might be called multiple times for the same channel and direction, to give the manager a chance to re-evaluate whether a chain is required for the given channel if the channel cache is flushed. When this method is called the manager must first decide whether it currently needs to have a chain for the specified channel, as some managers may only wish to take action if a channel with the specified name exists on the external system they are connected to.

The manager must also check if it already has a chain for this channel in the specified direction, since in some situations the listener will notify about creation of the same channel more than once.

If the manager has established that a chain is needed for this channel and none already exists it should create one, if a chain already exists for this channel but is no longer needed it should destroy it, and otherwise it should do nothing.

In the case where channel is created just after its destruction, it might be possible that onChannelCreated is called without onChannelDestroyed being called. So don't rely on the onChannelCreated and onChannelDestroyed invocations being paired.

Any transportwards event sent to a channel by EPL while onChannelCreated call is in progress will be delivered to any chain that is started by the listener within that call and is subscribed to the channel. Similarly any hostwards event sent sent be a chain started in onChannelCreated call to the channel created will be delivered to the monitor that subscribed to the channel.

Thread-safety: Any chain started in onChannelCreated should not send messages to host in start method of transport as it can cause deadlock because this method can be called from receiving thread. The transport can instead send the message from hostReady method which is always called from background thread. The method can be called from multiple threads so plug-in should take care of accessing any mutable state in a thread safe manner.

The ChannelLifecycleListener's onChannelCreated and onChannelDestroyed methods will not be called once the chain manager's shutdown() has begun, and any in-progress calls will be completed before shutdown() is invoked.

Parameters
channelthe name of the channel created
directionthe direction of channel, which is either towards the host or towards the transport.

◆ onChannelDestroyed()

virtual void com::softwareag::connectivity::chainmanagers::ChannelLifecycleListener::onChannelDestroyed ( const std::string &  channel,
Direction  direction 
)
pure virtual

Called by host when a channel is destroyed which starts with the prefix provided during listener registration.

The method can be called from multiple threads so plug-in should take care of accessing any mutable state in thread safe manner.

At present, channel destroy notifications are only sent for the TOWARDS_HOST direction (monitor.subscribe()) since in the TOWARDS_TRANSPORT direction (send ... to ...) there is no unambiguous way of determining when a channel is no longer needed.

The ChannelLifecycleListener's onChannelCreated and onChannelDestroyed methods will not be called once the chain manager's shutdown() has begun, and any in-progress calls will be completed before shutdown() is invoked.

Parameters
channelthe name of channel destroyed
directionthe direction of channel, which is either towards the host or towards the transport.

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