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));
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. | |
| EventSessionFactoryPtr EventSessionFactory::getFactory | ( | SpaceProxyPtr | space | ) | [static] |
Retrieves the EventSessionFactory according to the space.
| space | the associated space |
| space | the associated space |
| 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.
| config | the set of configuration params used to configure the session. | |
| tx | the bounded transaction. NULL if no transaction is needed. |
| RemoteException | when connection to the space fails. |
| config | the set of configuration params used to configure the session. | |
| tx | the bounded transaction. NULL if no transaction is needed. |
| 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.
| space | the bounded space | |
| tx | the bounded transaction. NULL if no transaction is needed. | |
| schemaName | the name of the predefined configuration schema |
| IOException | when schema name is invalid or when connection to the space fails. |
| space | the bounded space | |
| tx | the bounded transaction. NULL if no transaction is needed. | |
| schemaName | the name of the predefined configuration schema |
| IOException | when schema name is invalid or when connection to the space fails. |
1.5.3