com.pcbsys.nirvana.client.nSubscriptionAttributes Class Reference

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

Inherits com.pcbsys.nirvana.base.clientimpl.singleconnection.eventhandlers.nSubscriptionAttributesFriend.

Public Member Functions

nChannel getChannel ()
 Returns the valid nChannel object resulting from the subscription request. More...
 
String getChannelName ()
 Return the name of the channel. More...
 
long getEID ()
 Return the event id that the subscription will start from. More...
 
nBaseClientException getException ()
 If the channel subscription failed, this method will return a subclass of nBaseClientException that will detail the cause of the failure. More...
 
nEventListener getListener ()
 Return the nEventListener associated with this subscription. More...
 
String getSelector ()
 Return the selector for event event filtering on this subscription. More...
 
 nSubscriptionAttributes (String name, String selector, long eid, nEventListener eventCallback) throws nIllegalArgumentException
 Constructor for setting up the attributes for a subscription to a channel. More...
 
boolean 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 ( String  name,
String  selector,
long  eid,
nEventListener  eventCallback 
) throws nIllegalArgumentException

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
eventCallback- the nEventListener that will receive the callback when events are published
Exceptions
nIllegalArgumentExceptionif the channel is null

Member Function Documentation

nChannel com.pcbsys.nirvana.client.nSubscriptionAttributes.getChannel ( )

Returns the valid nChannel object resulting from the subscription request.

Returns
an instance of nChannel corresponding to the channel subscribed to
String com.pcbsys.nirvana.client.nSubscriptionAttributes.getChannelName ( )

Return the name of the channel.

Returns
channel name
long com.pcbsys.nirvana.client.nSubscriptionAttributes.getEID ( )

Return the event id that the subscription will start from.

Returns
the event id to start
nBaseClientException com.pcbsys.nirvana.client.nSubscriptionAttributes.getException ( )

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
nEventListener com.pcbsys.nirvana.client.nSubscriptionAttributes.getListener ( )

Return the nEventListener associated with this subscription.

Returns
the callback listener
String com.pcbsys.nirvana.client.nSubscriptionAttributes.getSelector ( )

Return the selector for event event filtering on this subscription.

Returns
the selector string
boolean com.pcbsys.nirvana.client.nSubscriptionAttributes.wasSuccessful ( )

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

Returns
true or false