ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » General IBM MQ Support » PYMQI CONN_ID

Post new topic  Reply to topic
 PYMQI CONN_ID « View previous topic :: View next topic » 
Author Message
bobbee
PostPosted: Wed Mar 22, 2023 8:14 am    Post subject: PYMQI CONN_ID Reply with quote

Knight

Joined: 20 Sep 2001
Posts: 541
Location: Tampa

I issue an INQUIRE_CONN, I am filtering the CONNs, when I fiind the one I am looking for, I save off the conn_id into conn_id, I then issue the following (I am looking for the list of Object Names associated with this CONN_ID):

Code:
conn__handle_response=pcf.MQCMD_INQUIRE_CONNECTION({pymqi.CMQCFC.MQBACF_CONNECTION_ID:conn_id,
                     pymqi.CMQCFC.MQIACF_CONN_INFO_TYPE:pymqi.CMQCFC.MQIACF_CONN_INFO_HANDLE,pymqi.CMQCFC.MQIACF_CONNECTION_ATTRS:pymqi.CMQCFC.MQIACF_ALL})


I get not found.

If I replace conn-id with pymqi.ByteString('') I get all the handles. Buried in the list is the handle I am looking for with the conn-id I wold have specified. Is there some translation I am missing? Here is the PRINT of the returned conn-id value.

7006: b'AMQCBOBBEE \xfdb\x02d\x01\x1e[!',

I did a length on this and it is 24
Back to top
View user's profile Send private message Send e-mail AIM Address
fjb_saper
PostPosted: Thu Mar 23, 2023 6:48 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

Looking at https://www.ibm.com/docs/en/ibm-mq/9.3?topic=formats-mqcmd-inquire-connection-inquire-connection , after specifying the connid,
shouldn't you ask for attributes all then specify the handle filter?
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
bobbee
PostPosted: Thu Mar 23, 2023 7:07 am    Post subject: Reply with quote

Knight

Joined: 20 Sep 2001
Posts: 541
Location: Tampa

I was trying to use the CONN_ID so I could then issue a INQ_CONN (handle) to get to the specific queues opened for that CONN_ID. For the life of me I could not get it to work.

So I asked for ALL the handles (messy) converted the conn_id to string and just used an 'if' statement looking for a match.The customer I gave this to has 7k+ connections. I do limit the HANDLE query to only connections that exceed a certain LUW in seconds.
Back to top
View user's profile Send private message Send e-mail AIM Address
hughson
PostPosted: Thu Mar 23, 2023 4:26 pm    Post subject: Re: PYMQI CONN_ID Reply with quote

Padawan

Joined: 09 May 2013
Posts: 1914
Location: Bay of Plenty, New Zealand

bobbee wrote:
I issue an INQUIRE_CONN, I am filtering the CONNs, when I fiind the one I am looking for, I save off the conn_id into conn_id, I then issue the following (I am looking for the list of Object Names associated with this CONN_ID):

Code:
conn__handle_response=pcf.MQCMD_INQUIRE_CONNECTION({pymqi.CMQCFC.MQBACF_CONNECTION_ID:conn_id,
                     pymqi.CMQCFC.MQIACF_CONN_INFO_TYPE:pymqi.CMQCFC.MQIACF_CONN_INFO_HANDLE,pymqi.CMQCFC.MQIACF_CONNECTION_ATTRS:pymqi.CMQCFC.MQIACF_ALL})


I've found that using this:-

Code:
args = {pymqi.CMQCFC.MQBACF_CONNECTION_ID: conn_id,
        pymqi.CMQCFC.MQIACF_CONNECTION_ATTRS: [pymqi.CMQCFC.MQIACF_ALL]}
response = pcf.MQCMD_INQUIRE_CONNECTION(args)


does not work, but using this:-

Code:
args= []
args.append(pymqi.CFBS(Parameter=pymqi.CMQCFC.MQBACF_CONNECTION_ID,String=conn_id))
args.append(pymqi.CFIL(Parameter=pymqi.CMQCFC.MQIACF_CONNECTION_ATTRS,Values=[pymqi.CMQCFC.MQIACF_ALL]))
response = pcf.MQCMD_INQUIRE_CONNECTION(args)


does. And yet they should be equivalent. This suggests a defect in PyMQI where it is not treating the MQBACF_CONNECTION_ID as a CFBS. When you force it to be a CFBS it works.

Cheers,
Morag
_________________
Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software
Back to top
View user's profile Send private message Visit poster's website
bobbee
PostPosted: Mon Apr 03, 2023 1:39 pm    Post subject: Reply with quote

Knight

Joined: 20 Sep 2001
Posts: 541
Location: Tampa

I did try you solution:

Code:
                args= []
                args.append(pymqi.CFBS(Parameter=pymqi.CMQCFC.MQBACF_CONNECTION_ID,String=conn_id))
                args.append(pymqi.CFIL(Parameter=pymqi.CMQCFC.MQIACF_CONN_INFO_TYPE,Values=[pymqi.CMQCFC.MQIACF_CONN_INFO_HANDLE]))
                args.append(pymqi.CFIL(Parameter=pymqi.CMQCFC.MQIACF_CONNECTION_ATTRS,Values=[pymqi.CMQCFC.MQIACF_ALL]))
                try:
                conn_handle_response=pcf.MQCMD_INQUIRE_CONNECTION(args)


It REALLY does not like the value I got returned for Conn_id!!!!!!!!!

Code:
[mqm@fibbing1 scripts]$ python3 ./conn_luw.py  conn_luw.config.properties
Queue Manager =  BOBBEE
<class 'float'>
Traceback (most recent call last):
  File "./conn_luw.py", line 485, in <module>
    if conn_check(QueueMGR):
  File "./conn_luw.py", line 187, in conn_check
    conn_handle_response=pcf.MQCMD_INQUIRE_CONNECTION(args)
  File "/usr/local/lib64/python3.6/site-packages/pymqi-1.12.0-py3.6-linux-x86_64.egg/pymqi/__init__.py", line 2723, in __call__
    message = message + parameter.pack()
  File "/usr/local/lib64/python3.6/site-packages/pymqi-1.12.0-py3.6-linux-x86_64.egg/pymqi/__init__.py", line 309, in pack
    ensure_not_unicode(v)  # Python 3 bytes check
  File "/usr/local/lib64/python3.6/site-packages/pymqi-1.12.0-py3.6-linux-x86_64.egg/pymqi/__init__.py", line 177, in ensure_not_unicode
    raise TypeError(msg.format(value))
TypeError: Python 3 style string (unicode) found but not allowed here: `b'AMQCBOBBEE      \xfdb\x02d\x01>\x8a!'`. Convert to bytes.
Back to top
View user's profile Send private message Send e-mail AIM Address
hughson
PostPosted: Mon Apr 03, 2023 1:50 pm    Post subject: Reply with quote

Padawan

Joined: 09 May 2013
Posts: 1914
Location: Bay of Plenty, New Zealand

Can you show us your code that sets the value of conn_id please? Is it bytes if you print out its type?

Cheers,
Morag
_________________
Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software
Back to top
View user's profile Send private message Visit poster's website
bobbee
PostPosted: Mon Apr 03, 2023 3:46 pm    Post subject: Reply with quote

Knight

Joined: 20 Sep 2001
Posts: 541
Location: Tampa

conn_id = str(conn_info[pymqi.CMQCFC.MQBACF_CONNECTION_ID])
Back to top
View user's profile Send private message Send e-mail AIM Address
hughson
PostPosted: Mon Apr 03, 2023 3:49 pm    Post subject: Reply with quote

Padawan

Joined: 09 May 2013
Posts: 1914
Location: Bay of Plenty, New Zealand

bobbee wrote:
conn_id = str(conn_info[pymqi.CMQCFC.MQBACF_CONNECTION_ID])


Don't turn it into a string - it's a bytes field.

The error even tells you that!

Code:
TypeError: Python 3 style string (unicode) found but not allowed here: `b'AMQCBOBBEE      \xfdb\x02d\x01>\x8a!'`. Convert to bytes.


My code just has:-
Code:
conn_id = conn_info[pymqi.CMQCFC.MQBACF_CONNECTION_ID]


Try it like that and see how you get on.

Cheers,
Morag
_________________
Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software
Back to top
View user's profile Send private message Visit poster's website
bobbee
PostPosted: Mon Apr 03, 2023 3:51 pm    Post subject: Reply with quote

Knight

Joined: 20 Sep 2001
Posts: 541
Location: Tampa

Let me reset that, I was changing all sorts of things trying to get it to work. Missed resetting that.
Back to top
View user's profile Send private message Send e-mail AIM Address
bobbee
PostPosted: Tue Apr 04, 2023 6:23 am    Post subject: Reply with quote

Knight

Joined: 20 Sep 2001
Posts: 541
Location: Tampa

Thanks M for catching my issue. That part of the code is working.
Back to top
View user's profile Send private message Send e-mail AIM Address
hughson
PostPosted: Tue Apr 04, 2023 9:00 pm    Post subject: Reply with quote

Padawan

Joined: 09 May 2013
Posts: 1914
Location: Bay of Plenty, New Zealand



You're welcome.

M
_________________
Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » General IBM MQ Support » PYMQI CONN_ID
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.