Nirvana Flex - Creating a Nirvana Channel or Queue
Creating a Nirvana Channel or Queue using the Nirvana Flex Client API
Resources can be created programatically as detailed below, or they can be created using the Nirvana enterprise manager.
In order to create a channel or queue, first of all you must create an nSession object, which is your effectively the logical and physical connection to a Nirvana Realm. This is achieved by using an RNAME for your Nirvana 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 Nirvana 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 Nirvana 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 Nirvana queue within the realm or an error.
