How to determine which server has a handle on a UM queue

I am trying to determine which servers have handles on a queue in UM. When I call the qPeek.java API it returns the “number of readers” however I’d like to know which specific server is connected to the queue.
Please can you detail how this can be achieved?
Many thanks :smiley:

  1. Get hold of nChannel or nQueue object of destination you are interested in
  2. Use getSession() on it to get nSession object (session associated with the channel/queue)
  3. Use getSubject() on nSession to get nSubject[] (subject here represents the client connected to queue/topic)
  4. Loop on the nSubject[] array and use getHost() or getName() methods to get host information

Below are the java namespaces of the classes in the order they were mentioned above:

  1. com.pcbsys.nirvana.client.nChannel or com.pcbsys.nirvana.client.nQueue
  2. com.pcbsys.nirvana.client.nSession
  3. com.pcbsys.nirvana.client.nSubject

Hi Prasad,

Thanks for your help. I’ve carried out your instructions however I only appear to get my connection when I connect to the remote realm - I have adapted the qPeek.java source and the relevant code can be seen as follows below:

nSubject[] nSubjectList = null;

		// Obtain the queue reference
		nQueue myQueue = mySession.findQueue(nca);
		nSession mySession = myQueue.getSession();
		nSubjectList = mySession.getSubject();
		nQueueDetails details = myQueue.getDetails();
		
		// Retrieve the hostname for inclusion in the logged message
			
		for (int i=0; i< nSubjectList.length; i++) 
			{	
			System.out.println("Host - get host: " + nSubjectList[i].getHost());
			System.out.println("Host - get name: " + nSubjectList[i].getName());			
			
			}

Have I understood your instructions correctly?
Thanks,
Lorraine

Hi… Yes, you did it right but, my bad, I missed the fact that getting a session back from nQueue will return the same session we used to find it. It will always give your client details only. Will have a look into API and get back to you.