EventSessionFactory Class Reference

List of all members.


Detailed Description

The EventSessionFactory is a static service class that creates DataEventSession - for handling data events.

The EventSessionFactory is associated with a space and is required in order to create a factory.
Once a factory has been created, it can be used to create sessions.
Every session is configured according to an EventSessionConfig object and is bounded to a transaction.

Sample usage:

The following code example shows how to create a session from a factory and register a listener to it.


  // 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:
IRemoteEventListener,EventSessionFactory,EventSessionConfig,DataEventSession,EventSession,EventRegistration,RemoteEvent
Author:
Ezer Ben Simhon

Public Member Functions

DataEventSessionPtr newDataEventSession (EventSessionConfigPtr config, TransactionPtr tx=NULL_TX)
 Creates a new DataEventSession bounded to the specified transaction, according to the configuration object.

Static Public Member Functions

static
EventSessionFactoryPtr 
getFactory (SpaceProxyPtr space)
 Retrieves the EventSessionFactory according to the space.
static
DataEventSessionPtr 
newDataSession (SpaceProxyPtr space, TransactionPtr tx=NULL_TX, const char *schemaName=NULL)
 Creates a new DataEventSession bounded to the specified space, specified transaction and a predefined configuration schema name.

Member Function Documentation

EventSessionFactoryPtr EventSessionFactory::getFactory ( SpaceProxyPtr  space  )  [static]

Retrieves the EventSessionFactory according to the space.

Parameters:
space the associated space
Returns:
the related factory.
Parameters:
space the associated space
Returns:
the related factory. or null in case of failure.

DataEventSessionPtr EventSessionFactory::newDataEventSession ( EventSessionConfigPtr  config,
TransactionPtr  tx = NULL_TX 
)

Creates a new DataEventSession bounded to the specified transaction, according to the configuration object.

creates a new DataEventSession bounded to the specified transaction,
according to the configuration object.

Parameters:
config the set of configuration params used to configure the session.
tx the bounded transaction. NULL if no transaction is needed.
Returns:
the newly created DataEventSession.
Exceptions:
RemoteException when connection to the space fails.
Parameters:
config the set of configuration params used to configure the session.
tx the bounded transaction. NULL if no transaction is needed.
Returns:
the newly created DataEventSession.
Exceptions:
RemoteException when connection to the space fails.

DataEventSessionPtr EventSessionFactory::newDataSession ( SpaceProxyPtr  space,
TransactionPtr  tx = NULL_TX,
const char *  schemaName = NULL 
) [static]

Creates a new DataEventSession bounded to the specified space, specified transaction and a predefined configuration schema name.

creates a new DataEventSession bounded to the specified space, specified transaction
and a predefined configuration schema name.

Parameters:
space the bounded space
tx the bounded transaction. NULL if no transaction is needed.
schemaName the name of the predefined configuration schema
Returns:
the DataEventSession
Exceptions:
IOException when schema name is invalid or when connection to the space fails.
Parameters:
space the bounded space
tx the bounded transaction. NULL if no transaction is needed.
schemaName the name of the predefined configuration schema
Returns:
the DataEventSession
Exceptions:
IOException when schema name is invalid or when connection to the space fails.


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