Universal Messaging 10.7 | Developer Guide | Enterprise APIs | Enterprise Developer's Guide for C# | Messaging API | MyChannels.Nirvana API: Creating and Disposing of a Session
 
MyChannels.Nirvana API: Creating and Disposing of a Session
Creating a session is extremely simple with the C# .NET MyChannels.Nirvana API. Simply create a new Session object with the desired RNAME, then call the Session.Initialize() method.

String RNAME = "nsp://127.0.0.1:9000";
Session session = new Session(RNAME);
session.Initialize();
DataGroups can be enabled on a session by setting the DataGroups.Enable flag, as shown below, before the call to Initialize() is made.

session.DataGroups.Enable = true;
To end a session, call the Session.Dispose() method.

session.Dispose();
Session Events
*AsynchronousExceptionRaised - fired when an asynchronous exception is thrown by the session
*ConnectionStatusChanged - fired when the connection status changes, for example when the connection is lost.