|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
![Reply to topic](templates/DAJ_Glass/images/lang_english/reply.gif) |
|
Query current Qmgr name |
« View previous topic :: View next topic » |
Author |
Message
|
fswarbrick |
Posted: Sun May 03, 2020 8:49 pm Post subject: Query current Qmgr name |
|
|
Apprentice
Joined: 07 Jul 2014 Posts: 42
|
So when you use the MQSERVER environment variable you don't actually supply the name of the queue manager. After I connect to it using MQCONN or MQCONNX, is there a way to query on the name of the queue manager I am connected to? |
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
PaulClarke |
Posted: Sun May 03, 2020 11:20 pm Post subject: |
|
|
![](images/avatars/46729506851b1e76395b14.jpg) Grand Master
Joined: 17 Nov 2005 Posts: 1002 Location: New Zealand
|
Yes you can do that using the MQINQ verb.
Regards,
Paul. _________________ Paul Clarke
MQGem Software
www.mqgem.com |
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
fswarbrick |
Posted: Mon May 04, 2020 2:52 pm Post subject: |
|
|
Apprentice
Joined: 07 Jul 2014 Posts: 42
|
I see how you can connect to a queue manager than then use MQINQ to get information about that queue manager. But its not clear to me how I can utilize this to retrieve information about the "unnamed" queue manager I am currently connected to. What am I missing? |
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
fswarbrick |
Posted: Mon May 04, 2020 3:31 pm Post subject: |
|
|
Apprentice
Joined: 07 Jul 2014 Posts: 42
|
As so often happens, after I make the request for help the answer comes to me. Looks like for a Q_MGR object you don't have to supply the object name, and it will use the name from your current connection. Works like a charm.
In case anyone in the future is interested, here is my code. Written in Go (!!!) but should be simple enough to translate to your preferred language.
Code: |
import mq "github.com/ibm-messaging/mq-golang/ibmmq"
func queryqmgr(qMgr mq.MQQueueManager) {
mqod := mq.NewMQOD()
mqod.ObjectType = mq.MQOT_Q_MGR
qObject, err := qMgr.Open(mqod, mq.MQOO_FAIL_IF_QUIESCING|mq.MQOO_INQUIRE)
if err != nil {
log.Panic(err)
}
reply, err := qObject.Inq([]int32{mq.MQCA_Q_MGR_NAME})
if err != nil {
log.Panic(err)
}
log.Printf("Connected to %v\n", reply[mq.MQCA_Q_MGR_NAME])
}
|
|
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
PaulClarke |
Posted: Mon May 04, 2020 5:01 pm Post subject: |
|
|
![](images/avatars/46729506851b1e76395b14.jpg) Grand Master
Joined: 17 Nov 2005 Posts: 1002 Location: New Zealand
|
Or, put another way, I told you the answer ![](images/smiles/icon_smile.gif) _________________ Paul Clarke
MQGem Software
www.mqgem.com |
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
|
|
![Reply to topic](templates/DAJ_Glass/images/lang_english/reply.gif) |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|