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. The steps below describe session creation.
-
Create a nSessionAttributes object with the RNAME value of your choice
String[] RNAME={"nsp://127.0.0.1:9000"}; nSessionAttributes nsa=new nSessionAttributes(RNAME);
-
Call the create method on nSessionFactory to create your session
nSession mySession=nSessionFactory.create(nsa)
Alternatively, if you require the use of a session reconnect handler (nReconnectHandler) to intercept the automatic reconnection attempts, pass an instance of that class too in the create method:
public class myReconnectHandler implements nReconnectHandler{ //implement tasks associated with reconnection } myReconnectHandler rhandler=new myReconnectHandler(); nSession mySession=nSessionFactory.create(nsa, rhandler);
-
Initialise the session object to open the connection to the Universal Messaging Realm
mySession.init();
After initialising your Universal Messaging session, you will be connected to the Universal Messaging Realm. From that point, all functionality is subject to a Realm ACL check. If you call a method that requires a permission your credential does not have, you will receive an nSecurityException.