Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python IBM统计数据订阅主题始终返回原因2033:失败:MQRC\u NO\u MSG\u AVAILABLE_Python_Python 3.x_Ibm Mq_Messagebroker_Pymqi - Fatal编程技术网

Python IBM统计数据订阅主题始终返回原因2033:失败:MQRC\u NO\u MSG\u AVAILABLE

Python IBM统计数据订阅主题始终返回原因2033:失败:MQRC\u NO\u MSG\u AVAILABLE,python,python-3.x,ibm-mq,messagebroker,pymqi,Python,Python 3.x,Ibm Mq,Messagebroker,Pymqi,我正在尝试将一些旧的java代码移植到python 我正在使用pymqi连接到队列管理器,并使用主题字符串查询所有messageflow统计主题:$SYS/Broker/+/StatisticsAccounting/Archive/# 使用现有java程序时,从主题中读取消息时不会出现问题。 当使用新的python代码时,它能够毫无问题地连接和查询主题,但总是给出消息 Reason 2033: FAILED: MQRC_NO_MSG_AVAILABLE 代理每10分钟为每个消息流发布一次Sta

我正在尝试将一些旧的java代码移植到python

我正在使用pymqi连接到队列管理器,并使用主题字符串查询所有messageflow统计主题:$SYS/Broker/+/StatisticsAccounting/Archive/#

使用现有java程序时,从主题中读取消息时不会出现问题。 当使用新的python代码时,它能够毫无问题地连接和查询主题,但总是给出消息

Reason 2033: FAILED: MQRC_NO_MSG_AVAILABLE
代理每10分钟为每个消息流发布一次Stats消息,我让新代码运行了30多分钟,从未收到消息

我也试过设置

get_opts['WaitInterval'] = pymqi.CMQC.MQWI_UNLIMITED 
坐上20分钟,而不是使用循环,但没有运气

是否有任何IIB服务器配置可能会影响我能够看到的消息,或者是否有其他选项我应该在客户端中使用

import pymqi

queue_manager = 'MYQM'
channel = 'MYAPP.SVRCONN'
host = 'MYHOST'
port = 'MYPORT'
topic_string = '$SYS/Broker/+/StatisticsAccounting/Archive/#'
conn_info = '%s(%s)' % (host, port)
user = ""
password = ""

qmgr = pymqi.QueueManager(None)
qmgr.connect_tcp_client(queue_manager, pymqi.CD(), channel, conn_info, user, password)
sub_desc = pymqi.SD()
sub_desc['Options'] = pymqi.CMQC.MQSO_CREATE + pymqi.CMQC.MQSO_RESUME + pymqi.CMQC.MQSO_MANAGED
sub_desc.set_vs('SubName', 'apptest')
sub_desc.set_vs('ObjectString', topic_string)
sub = pymqi.Subscription(qmgr)
sub.sub(sub_desc=sub_desc)
get_opts = pymqi.GMO(Options=pymqi.CMQC.MQGMO_WAIT)
get_opts['WaitInterval'] = 10000

md = pymqi.md()
keep_running = True
while keep_running:
    try:
        # Reset the MsgId, CorrelId & GroupId so that we can reuse
        # the same 'md' object again.
        md.MsgId = pymqi.CMQC.MQMI_NONE
        md.CorrelId = pymqi.CMQC.MQCI_NONE
        md.GroupId = pymqi.CMQC.MQGI_NONE

        message = sub.get(None, md, get_opts)
        print('Have message from Queue')
        print(message)

    except pymqi.MQMIError as e:
        if e.comp == pymqi.CMQC.MQCC_FAILED and e.reason == pymqi.CMQC.MQRC_NO_MSG_AVAILABLE:
            print("no message?")
            print(e)
            pass
        else:
            # Some other error condition.
            raise

    except (UnicodeDecodeError, ValueError)  as e:
        print('Message is not valid json')
        print(e)
        print(message)
        continue

    except KeyboardInterrupt:
        print('Have received a keyboard interrupt')
        keep_running = False


sub.close(sub_close_options=0,close_sub_queue=True)
qmgr.disconnect()



请在订阅运行30分钟后(在订阅仍在运行时)发出以下命令,并将响应添加到上述问题描述中。DISPLAY TPSTATUS(“$SYS/Broker/+/statisticscomping/Archive/#”)TYPE(SUB)所有此命令将显示发送到订阅者的消息数(NUMMSGS字段),并显示问题是在检索消息还是它们甚至没有发送到订阅者。您好,我想您希望我在代理端发出此命令,而不是来自python脚本?这是针对队列管理器运行的MQSC命令。AMQ8754:显示主题状态详细信息。TOPICSTR($SYS/Broker/BROKERNAME/statistics accounting/Archive/SUPC_Internal/flowName)SUBID(414D5120564E53511202020205F6F4490287598D0)SUBUSER(itmagent)RESMDATE(2020-10-19)RESMTIME(09:45:24)LMSGDATE(2020-10-29)LMSGTIME(12:04:18)ACTCONN(000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000子用户(mqtest)RESMDATE(2020-10-29)RESMTIME(11:23:30)LMSGDATE()LMSGTIME()ACTCONN(414D5143564D51494E53541202020205F93801F22A56B06)持久(无)子类型(API)MCASTREL(,)NUMMSGS(0)