Universal Messaging Developer Guide : Enterprise APIs : Enterprise Developer's Guide for C# : Publish / Subscribe using Datastreams and Datagroups : Managing Datagroups : Creating and Deleting DataGroups
Creating and Deleting DataGroups
Creating Universal Messaging DataGroups
nDataGroups can be created programmatically as detailed below, or they can be created using the Universal Messaging enterprise manager.
In order to create a nDataGroup, first of all you must create an nSession object with an nDataStreamListener. This is effectively your logical and physical connection to a Universal Messaging Realm. This is achieved by using an RNAME for your Universal Messaging Realm when constructing the nSessionAttributes object, as shown below:

string[] RNAME={"nsp://127.0.0.1:9000"};
nSessionAttributes nsa=new nSessionAttributes(RNAME);
nSession mySession=nSessionFactory.create(nsa);
mySession.init(this); // where this is an nDataStreamListener
Once the nSession.init() method is successfully called, your connection to the realm will be established.
Using the nSession object instance 'mySession', you can then create DataGroups. The create DataGroup methods will return the nDataGroup if it already exists.
The code snippets below demonstrate the creation of nDataGroups:
Create a Single nDataGroup

nDataGroup myGroup = mySession.createDataGroups("myGroup");
Create Multiple nDataGroups

string[] groups = {"myFirstGroup", "mySecondGroup"};
IEnumerable<nDataGroup> myGroups = mySession.createDataGroups(groups);
Creating DataGroups with DataGroupListeners and ConflationAttributes
It is also possible to specify additional properties when creating DataGroups:
*nDataGroupListener - To specify a listener for DataGroup membership changes
*nConflationAttributes - To specify attributes which control event merging and delivery throttling for the DataGroup
Now we have a reference to a Universal Messaging DataGroup it is possible to publish events
Deleting Universal Messaging DataGroups
There are various deleteDataGroup methods available on nSession which will delete DataGroups. It is possible to specify single nDataGroups or arrays of nDataGroups.
Copyright © 2013-2016 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback