• webspaher mq get消息为最早的消息


    import sys
    import os
    import pymqi
    import time
    import re
    if len(sys.argv) != 5:
        print sys.argv[0] + ' ' + 'queue_manager' + ' ' + 'channel' + ' ' + 'host' + ' ' + 'port'
    else:
        queue_manager = sys.argv[1]
        channel = sys.argv[2]
        host = sys.argv[3]
        port = sys.argv[4]
        conn_info = "%s(%s)" % (host, port)
        prefix = "*"
        queue_type = pymqi.CMQC.MQQT_LOCAL
        args = {pymqi.CMQC.MQCA_Q_NAME: prefix,
               pymqi.CMQC.MQIA_Q_TYPE: queue_type}
        print '-----------------------------------------'
        print args
        print '-----------------------------------------'
        qmgr = pymqi.connect(queue_manager, channel, conn_info)
        pcf = pymqi.PCFExecute(qmgr)
        response = pcf.MQCMD_INQUIRE_Q(args)
        for queue_info in response:
            queue_name = queue_info[pymqi.CMQC.MQCA_Q_NAME]
            if (re.match('^SYSTEM',queue_name) or re.match('^AMQ',queue_name) or re.match('^MQ',queue_name)):
                pass
            else:
                q = pymqi.Queue(qmgr, queue_name)
                print(queue_name.strip() +':'+'Queue  depth:', q.inquire(pymqi.CMQC.MQIA_CURRENT_Q_DEPTH))
                q.close()
        qmgr.disconnect()
    	
    	[mqm@node01 sbin]$ python disdepth.py  YWJZZF_CZCB_SEND CHANNEL1 127.0.0.1 5015
    -----------------------------------------
    {2016: '*', 20: 1}
    -----------------------------------------
    ('CZ_RSP:Queue  depth:', 1)
    ('DEADQ:Queue  depth:', 3)
    ('ERRMSG:Queue  depth:', 0)
    ('SEND000:Queue  depth:', 8)
    
    
    
    
    
    mq 消息放入顺序:
    [mqm@node01 bin]$ amqsput  CZ_RSP YWJZZF_CZCB_SEND
    Sample AMQSPUT0 start
    target queue is CZ_RSP
    a111111111
    ^C
    [mqm@node01 bin]$ amqsput  CZ_RSP YWJZZF_CZCB_SEND^C
    [mqm@node01 bin]$ set -o vi
    [mqm@node01 bin]$ ^Crl get_mq_message.pl  YWJZZF_CZCB_SEND CHANNEL1 192.168.137.2 5015 CZ_RSP
    [mqm@node01 bin]$ amqsput  CZ_RSP YWJZZF_CZCB_SEND
    Sample AMQSPUT0 start
    target queue is CZ_RSP
    b2222222
    c33333333
    
    [mqm@node01 sbin]$ perl read_mq_message.pl YWJZZF_CZCB_SEND CHANNEL1 192.168.137.2 5015 CZ_RSP
    CZ_RSP 当前队列深度为==3
    MsgSeqNumber====1
    第一条消息内容==a111111111
    
    mqm@node01 sbin]$ perl get_mq_message.pl YWJZZF_CZCB_SEND CHANNEL1 192.168.137.2 5015 CZ_RSP
    CZ_RSP 当前队列深度为==3
    MsgSeqNumber====1
    第一条消息内容==a111111111
    [mqm@node01 sbin]$ perl get_mq_message.pl YWJZZF_CZCB_SEND CHANNEL1 192.168.137.2 5015 CZ_RSP
    CZ_RSP 当前队列深度为==2
    MsgSeqNumber====1
    第一条消息内容==b2222222
    [mqm@node01 sbin]$ perl get_mq_message.pl YWJZZF_CZCB_SEND CHANNEL1 192.168.137.2 5015 CZ_RSP
    CZ_RSP 当前队列深度为==1
    MsgSeqNumber====1
    第一条消息内容==c33333333
    [mqm@node01 sbin]$ 

  • 相关阅读:
    【Selenium IDE】下载安装Chrome和Firefox插件IDE ide了解就行 不是重点 重点是写脚本
    调用接口时,生产环境,路径加斜杠“/”和不加的区别
    WPF 踩坑笔记12 DataGrid触发选中行事件
    WPF 踩坑笔记11 线程取消
    WPF 踩坑笔记10 ListBox异步动态加载
    WPF 踩坑笔记9 直接打印
    思维的体操
    【洛谷 P4213】 【模板】杜教筛(Sum)
    【洛谷 P2257】 YY的GCD(莫比乌斯反演)
    【洛谷 P4980】 【模板】Pólya 定理
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13349179.html
Copyright © 2020-2023  润新知