DataEventSession Class Reference

Inheritance diagram for DataEventSession:

EventSession

List of all members.


Detailed Description

The common interface that is used when working with data events.

Listeners can be registered using the addListener() methods and receive an EventRegistration that will be used to unregister using the removeListener().
When a listener is detroyed it automaticaly unregister.

Sample usage:

Here is an example of using DataEventSession for registring a listener over matching entries:


  // Prepare the session
  EventSessionFactoryPtr factory( EventSessionFactory::getFactory(spaceProxy));

  // create a session configuration
  EventSessionConfigPtr config( EventSessionConfig::CreateSessionConfig(spaceProxy));
  config->setComType(ComType::UNICAST); // or MULTIPLEX,MULTICAST

  // creating a new DataEventSession
  DataEventSessionPtr session (factory->newDataEventSession(config) );

  // Create the listener using the class we defined
  PersonNotifyListener listener;

  // Register for notifications by adding the listener to the space with the Person template

  Person personTemplate;
  EventRegistrationPtr reg( session->addListener( &personTemplate, &listener, Lease::FOREVER, NotifyModifiers::NOTIFY_WRITE));

 

Author:
Ezer Ben Simhon
See also:
IRemoteEventListener,EventSessionFactory,EventSessionConfig,DataEventSession,EventSession,EventRegistration,RemoteEvent

Public Member Functions

EventRegistrationPtr addListener (const SqlQuery &sqlQuery, IRemoteEventListener *pListener, long long timeout=MAX_TIMEOUT, int actionTypes=NotifyModifiers::NOTIFY_ALL)
 Registers a listener with a space using a template.
EventRegistrationPtr addListener (IEntry *pIEntryTemplate, IRemoteEventListener *pListener, long long timeout=MAX_TIMEOUT, int actionTypes=NotifyModifiers::NOTIFY_ALL)
 Registers a listener with a space using a template.
virtual void close ()
 Closes the session and unregisters all listeners.
void removeListener (EventRegistrationPtr registration)
 Unregisters the listener from the space.

Member Function Documentation

EventRegistrationPtr DataEventSession::addListener ( const SqlQuery sqlQuery,
IRemoteEventListener pListener,
long long  timeout = MAX_TIMEOUT,
int  actionTypes = NotifyModifiers::NOTIFY_ALL 
)

Registers a listener with a space using a template.

Parameters:
sqlQuery - SqlQuery object used for matching.
pListener - user defined listener implementing IRemoteEventListener
timeout - the time duration in which the listener will be receiving calls. Default value is MAX_TIMEOUT.
actionTypes - the type of actions you wish to receive notification on, see NotifyModifiers. Default value is NotifyModifiers::NOTIFY_ALL.
Returns:
the EventRegistration object.
Exceptions:
RemoteException if the space has failed to perform the registration
TransactionException if the transaction associated with this session has expired.

EventRegistrationPtr DataEventSession::addListener ( IEntry pIEntryTemplate,
IRemoteEventListener pListener,
long long  timeout = MAX_TIMEOUT,
int  actionTypes = NotifyModifiers::NOTIFY_ALL 
)

Registers a listener with a space using a template.

Parameters:
pIEntryTemplate - Pointer to an IEntry template used for matching.
pListener - user defined listener implementing IRemoteEventListener
timeout - the time duration in which the listener will be receiving calls. Default value is MAX_TIMEOUT.
actionTypes - the type of actions you wish to receive notification on, see NotifyModifiers. Default value is NotifyModifiers::NOTIFY_ALL.
Returns:
the EventRegistration object.
Exceptions:
RemoteException if the space has failed to perform the registration
TransactionException if the transaction associated with this session has expired.

void DataEventSession::close ( void   )  [virtual]

Closes the session and unregisters all listeners.

Exceptions:
RemoteException if the remove space failed to remove the notification registration.
UnknownLeaseException if the listeners lease has expired.

Implements EventSession.

void DataEventSession::removeListener ( EventRegistrationPtr  registration  ) 

Unregisters the listener from the space.

Parameters:
registration - the registration object received from the server when the listener was added.
Exceptions:
RemoteException if the space has failed to unregister the listener.
UnknownLeaseException if the lease of the registration is invalid.
See also:
addListener()


Generated on Thu Jul 22 08:11:54 2010 for GigaSpaces XAP 10.2.1 C++ by  doxygen 1.5.3