|
Finding a Nirvana
queue using the Nirvana Client API
In order to find a queue, first of all the queue must
be created. This can be achieved through the Nirvana
Administration Tool, or programatically.
First of all you must create your nSession
object, which is your effectively your logical and physical
connection to a Nirvana Realm. This is achieved by using
the correct RNAME
for your Nirvana 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 objects instance 'mySession',
we can then try to find the queue object. Queues
have an associated set of attributes,
that define their behaviour within the Nirvana Realm
Server. As well as the name of the queue, the attributes
determine the availability of the events published to
a queue to any consumers wishing to consume them,
To find a queue previously created, we do the following:
nChannelAttributes cattrib = new nChannelAttributes();
cattrib.setName(“myqueue”);
nQueue myQueue=mySession.findQueue(cattrib);
Now we have a reference to a Nirvana queue within the
realm.
|