com::pcbsys::nirvana::client::nSubscriptionAttributes Class Reference

This class represents the attributes used for channel subscriptions. More...

#include <nSubscriptionAttributes.h>

Inherits Countable.

Public Member Functions

virtual nChannelgetChannel ()
 Returns the valid nChannel object resulting from the subscription request. More...
 
virtual const std::string & getChannelName ()
 Return the name of the channel. More...
 
virtual longlong getEID ()
 Return the event id that the subscription will start from. More...
 
virtual nBaseClientExceptiongetException ()
 If the channel subscription failed, this method will return a subclass of nBaseClientException that will detail the cause of the failure. More...
 
virtual nEventListenergetListener ()
 Return the nEventListener associated with this subscription. More...
 
virtual const std::string & getSelector ()
 Return the selector for event event filtering on this subscription. More...
 
 nSubscriptionAttributes (const std::string &name, const std::string &selector, longlong eid, nEventListener *pEventCallback)
 Constructor for setting up the attributes for a subscription to a channel. More...
 
virtual bool wasSuccessful ()
 Return whether the channel has been successfully found and subscribed to. More...
 

Detailed Description

This class represents the attributes used for channel subscriptions.

It comprises of the channel name, an optional selector, an initial event id, and the listener that will receive the callback for events consumed.

This object can be used in conjunction with the nSession.subscribe method that accepts an array of nSubscriptionAttributes objects. Once the method returns from the server, the nSubscriptionAttributes objects can be validated, by checking the wasSuccessful() method.

If wasSuccessful() returns true, the nChannel object can be obtained from calling nSubscriptionAttributes.getChannel(). If wasSuccessful() returns false, an exception will be found by calling nSubscriptionAttributes.getException()

Since
6.0

Constructor & Destructor Documentation

com::pcbsys::nirvana::client::nSubscriptionAttributes::nSubscriptionAttributes ( const std::string &  name,
const std::string &  selector,
longlong  eid,
nEventListener pEventCallback 
)

Constructor for setting up the attributes for a subscription to a channel.

Parameters
name- the full name of the channel
selector- an optional selector provided for event filtering
eid- an initial start event id
*pEventCallback- the nEventListener that will receive the callback when events are published
Exceptions
nIllegalArgumentException

Member Function Documentation

virtual nChannel* com::pcbsys::nirvana::client::nSubscriptionAttributes::getChannel ( )
virtual

Returns the valid nChannel object resulting from the subscription request.

Returns
an instance of nChannel corresponding to the channel subscribed to
virtual const std::string& com::pcbsys::nirvana::client::nSubscriptionAttributes::getChannelName ( )
virtual

Return the name of the channel.

Returns
channel name
virtual longlong com::pcbsys::nirvana::client::nSubscriptionAttributes::getEID ( )
virtual

Return the event id that the subscription will start from.

Returns
the event id to start
virtual nBaseClientException* com::pcbsys::nirvana::client::nSubscriptionAttributes::getException ( )
virtual

If the channel subscription failed, this method will return a subclass of nBaseClientException that will detail the cause of the failure.

Returns
instance of : nSecurityException, nChannelNotFoundException or nIllegalChannelMode
virtual nEventListener* com::pcbsys::nirvana::client::nSubscriptionAttributes::getListener ( )
virtual

Return the nEventListener associated with this subscription.

Returns
the callback listener
virtual const std::string& com::pcbsys::nirvana::client::nSubscriptionAttributes::getSelector ( )
virtual

Return the selector for event event filtering on this subscription.

Returns
the selector string
virtual bool com::pcbsys::nirvana::client::nSubscriptionAttributes::wasSuccessful ( )
virtual

Return whether the channel has been successfully found and subscribed to.

Returns
true or false