Universal Messaging 10.11 | Developer Guide | Enterprise APIs | Enterprise Developer's Guide for C++ | General Features | Creating a Session
 
Creating a Session
To interact with a Universal Messaging Server, the first thing to do is create a Universal Messaging Session (nSession) object, which is effectively your logical and physical connection to a Universal Messaging Realm.
Creating a Universal Messaging Session Object
1. Create a nSessionAttributes object with the RNAME value of your choice

std::string[] RNAME={"nsp://127.0.0.1:9000"};
int length = 1;
nSessionAttributes *nsa=new nSessionAttributes(RNAME,length)
2. Call the create method on nSessionFactory to create your session

Session *mySession = nSessionFactory::create(nsa);
Alternatively, if you require the use of a session reconnect handler to intercept the automatic reconnection attempts, pass an instance of that class too in the create method:

class myReconnectHandler :
public nReconnectHandler
{

//implement tasks associated with reconnection

}

myReconnectHandler rhandler=new myReconnectHandler();
nSession *mySession=nSessionFactory::create(nsa, rhandler);

Initializing a Universal Messaging Session
1. Initialise the session object to open the connection to the Universal Messaging Realm

mySession->init();