使用适用于.Net的WebSphere MQ类查找XMIT队列深度 [英] Finding XMIT Queue Depth using WebSphere MQ Classes for .Net

查看:119
本文介绍了使用适用于.Net的WebSphere MQ类查找XMIT队列深度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用

I want to get the Queue Depth for a Transmission Queue (XMIT queue) using WebSphere MQ Classes for .Net , can someone kindly help me giving a specific link/Pseudocode or .Net Classes/API to identify the XMIT queue depth. I have gone through the .Net API but didn't find any info on XMIT queue.

推荐答案

您可以使用MQ .NET PCF接口来查询队列属性.下面是示例代码段.

You can use the MQ .NET PCF interface to query queue attributes. Below is the sample code snippet.

注意:MQ .NET PCF接口是未记录的接口,可能不受支持.您将需要咨询IBM.

    public static void InquireQueue()
    {
        PCFMessageAgent messageAgent = null;
        try
        {
            // Create connection to queue manager
            messageAgent = new PCFMessageAgent("QM3");

            // Build Inquire command to query attributes a queue
            PCFMessage pcfMsg = new PCFMessage(MQC.MQCMD_INQUIRE_Q);
            pcfMsg.AddParameter(MQC.MQCA_Q_NAME, "TO.QM2");

            // Send request and receive response
            PCFMessage[] pcfResponse = messageAgent.Send(pcfMsg);

            // Process and print response.
            int pcfResponseLen = pcfResponse.Length;
            for (int pcfResponseIdx = 0; pcfResponseIdx < pcfResponseLen; pcfResponseIdx++)
            {
                PCFParameter[] parameters = pcfResponse[pcfResponseIdx].GetParameters();
                foreach (PCFParameter pm in parameters)
                {
                    // We just want to print current queue depth only
                    if (pm.Parameter == MQC.MQIA_CURRENT_Q_DEPTH) 
                        Console.WriteLine("Queue Depth" + " - " + pm.GetValue());
                }
            }
        }
        catch (PCFException pcfEx)
        {
            Console.Write(pcfEx);
        }
        catch (MQException ex)
        {
            Console.Write(ex);
        }
        finally
        {
            if (messageAgent != null)
                messageAgent.Disconnect();
        }
    }

这篇关于使用适用于.Net的WebSphere MQ类查找XMIT队列深度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆