EventRegistration Class Reference

List of all members.

Detailed Description

A utility class for use as a return value for event-interest registration methods.

Objects of this class are meant to encapsulate the information needed by a client to identify a notification as a response to a registration request and to maintain that registration request. It is not mandatory for an event-interest registration method to use this class. A registration of interest in some kind of event that occurs within the scope of a transaction is leased in the same way as other event interest registrations. However, the duration of the registration is the minimum of the length of the lease and the duration of the transaction. Simply put, when the transaction ends (either because of a commit or an abort) the interest registration also ends. This is true even if the lease for the event registration has not expired and no call has been made to cancel the lease.

  // 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));

See also:

Public Member Functions

 EventRegistration (SpaceProxyPtr pxy, int eventID, long long lease, long long seqNum)
long long getID ()
LeasePtr getLease ()
long long getSequenceNumber ()

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