• 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]$ 

  • 相关阅读:
    java实现土地测量
    java实现土地测量
    java实现土地测量
    java实现土地测量
    ajax异步获取数据后动态向表格中添加数据(行)
    jquery如何通过ajax请求获取后台数据显示在表格上
    Eclipse4.5在线安装Aptana插件及配置代码提示教程
    eclipse安装Aptana 插件,并设置使之能提示css,js,html,帮助编写代码
    jsp页面根据json数据动态生成table
    Jquery根据JSON生成Table
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13349179.html
Copyright © 2020-2023  润新知