Creating a Universal Messaging Channel or Queue
Resources can be created programmatically as detailed below, or they can be created using the Enterprise Manager.
In order to create a channel or queue, first of all you must create an nSession object, which is effectively 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. This is covered in
Creating a Session.
Using the nSession objects instance mySession', we can then begin creating the channel object. Channels have an associated set of channel attributes or queue attributes, that define their behaviour within the Universal Messaging Realm Server. As well as the name of the channel or queue, the attributes determine the availability of the events published to a channel to any subscribers wishing to consume them.
To create a channel, we do the following:
var attributes:nChannelAttributes = new nChannelAttributes();
attributes.maxEvents = 0;
attributes.TTL=0;
attributes.type = nChannelAttributes.PERSISTENT_TYPE;
attributes.name = “mychannel”;
mySession.createStore(attributes,channelCallback);
Now we will get a call back to channelCallback and have a reference to a Universal Messaging channel within the realm or an error.
To create a queue, we do the following:
var attributes:nQueueAttributes = new nQueueAttributes();
attributes.maxEvents = 0;
attributes.TTL=0;
attributes.type = nQueueAttributes.PERSISTENT_TYPE;
attributes.name = “myQueue”;
mySession.createStore(attributes,queueCallback);
Now we will get a call back to queueCallback and have a reference to a Universal Messaging queue within the realm or an error.