5

in my Java application I get MQQueue object using

MQQueue tQueue  = qManager.accessQueue(tqName, tqOptions);

The queue is a remote queue. Is there way to get corresponding local transmission queue ?

(Using MQ 7.5)

Thanks

ValerieLampkin
  • 2,620
  • 13
  • 27

2 Answers2

3

Yes, using runmqsc console.

First on a command prompt run

runmqsc <qmgr>.

Once the console opens run

dis qr<remote q> XMITQ

to display the transmit queue used by the remote queue definition.

UPDATE

Another method is to use PCF classes.

      PCFMessageAgent pcfma = new PCFMessageAgent("QM");
      PCFMessage pcfCmd = new PCFMessage(MQConstants.MQCMD_INQUIRE_Q);
      pcfCmd.addParameter(MQConstants.MQCA_Q_NAME, "Q.REMOTE");
      PCFMessage[] pcfResponse = pcfma.send(pcfCmd);
      String xmitQName = (String) pcfResponse[0].getParameterValue(MQConstants.MQCA_XMIT_Q_NAME);
      System.out.println("XmitQ name " + xmitQName);
Shashi
  • 14,980
  • 2
  • 33
  • 52
  • My question is about programmatic way to get it from within my Java program. Program knows name of queue manager and name of the queue. By calling getQueueType() it can find out whether queue is local or remote. Now, if queue is remote, how program get find its corresponding local transmission queue? Are there any API calls I can use? – Aleksandr Broytman Jun 30 '15 at 15:21
1

When MQ opens a queue it runs a name resolution process to resolve which local queue to open. If the app opens a QRemote, it generally resolves to a transmission queue.

Finding out the name of the resolved queue is easy. Just ask MQ for it after the queue is successfully opened:

public java.lang.String getResolvedQName( )

T.Rob
  • 31,522
  • 9
  • 59
  • 103
  • Thanks, but unfortunately it did not work. Here is my code: – Aleksandr Broytman Jul 01 '15 at 13:55
  • Thanks, but unfortunately it did not work. When I call getResolvedType() it returns me 1 (local), but getResolvedName() still returns name of remote queue – Aleksandr Broytman Jul 01 '15 at 14:02
  • I was able to get the name by getAttributeString(CMQC.MQCA_XMIT_Q_NAME, CMQC.MQ_Q_NAME_LENGTH); – Aleksandr Broytman Jul 01 '15 at 14:27
  • Either you are accessing the field before the queue is opened, or else you've found a bug. The C interface returns the resolved local queue name in that field and if the Java interface returns something different IBM will fix it under a PMR. But I suspect this might be a timing issue. The only time the resolved queue name can *ever* be something other than a `QLOCAL` is *before* the QMgr has run the name resolution. Arguably even then it would be an error since the field should be blank until the API call returns.. – T.Rob Jul 01 '15 at 18:05
  • int openOptions = CMQC.MQOO_OUTPUT | CMQC.MQOO_FAIL_IF_QUIESCING | CMQC.MQOO_INQUIRE;MQQueue rQueue = sender.qMgr.accessQueue(queueName, openOptions);String name = rQueue.getResolvedQName(); - this is sample of the code. Sorry, have not learned how to format it here – Aleksandr Broytman Jul 02 '15 at 18:50
  • You are bumping into the intentional design limitations that Stack OVerflow is not a forum. As a Q&A site, the intention is that relevant updates to the question are added to the question and those to the answer added to the answer. Comments are for asking for additional info or clarification. If you make that update in your question you will be able to format it. – T.Rob Jul 02 '15 at 20:54