Universal Messaging 10.1 | Developer Guide | Enterprise APIs | Enterprise Developer's Guide for C++ | Publish / Subscribe using Datastreams and 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, which is effectively your the 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:

std::string* RNAME={"nsp://"};
nSessionAttributes* nsa=new nSessionAttributes(RNAME);
nSession* mySession=nSessionFactory::create(nsa);
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

std::string* groups = {"myFirstGroup", "mySecondGroup"};
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.