Universal Messaging Developer Guide : The Enterprise Client APIs : The Universal Messaging Java Enterprise Developer's Guide : Universal Messaging Java - Publish / Subscribe Using DataStreams and DataGroups : Universal Messaging Java - Creating and Deleting DataGroups
Universal Messaging Java - 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 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();
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"};
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-2014 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback