从C#/。NET进行MQ统计信息监视 [英] MQ Statistics Monitoring from C#/.NET

查看:113
本文介绍了从C#/。NET进行MQ统计信息监视的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

与我们交易MQ数据的供应商之一的监视器显示以下内容:

One of the vendors that we trade MQ data with has a monitor that shows the following:

我已经编写了自己的C#监视器,可以对队列深度进行快照每x分钟,但我想知道如何获取入队和出队的消息数。在我看来,这两个统计数据具有不同的性质。对我来说,队列深度是在给定的时间点。上面的报告实际上显示了5分钟内的高Q深度。

I've written a C# monitor of my own that takes a snap shot of the queue depth every x minutes, but I would like to know how to get the number of message enqueued and dequeued. These two stats seem to me to be of a different nature. To me queue depth is at a given point in time. The report above is actually showing "High Q Depth" for a 5 minute time period.

有人可以向我指出C#/。NET MQ API指南中有关如何收集这些统计信息的内容吗?如果没有,什么技巧或工具可能能够获得这些统计信息?

Can someone point me to something in the C#/.NET MQ API guide on how these statistics can be gathered? If not, what trick or tool might be able to get these stats?

推荐答案

IBM.WMQ.PCF 命名空间。有诸如 PCFAgent,PCFMessage 之类的类。这些可以用来读取PCF消息。

MQ .NET has undocumented "support" for PCF under IBM.WMQ.PCF namespace. There are classes like PCFAgent, PCFMessage and so on. These can be used to read PCF messages.

对于静态监视,可以在队列上打开队列静态。如此处所述队列静态消息包括诸如从队列中放入或检索到的消息数之类的信息。

For statics monitoring, you can turn on "Queue Statics" on queue. As described here queue statics messages include information like number of messages put or retrieved from a queue.

示例代码:此代码向队列管理器查询名称为Q1的队列。

Sample code: This code inquires a queue manager for a queue with name Q1.

    public void InquireQmgr()
    {
        try
        {
            PCFMessageAgent messageAgent = new PCFMessageAgent("QM");

            PCFMessage pcfMsg = new PCFMessage(MQC.MQCMD_INQUIRE_Q);
            pcfMsg.AddParameter(MQC.MQCA_Q_NAME, "Q1");

            PCFMessage[] pcfResponse = messageAgent.Send(pcfMsg);
            int pcfResponseLen = pcfResponse.Length;

            for (int pcfResponseIdx = 0; pcfResponseIdx < pcfResponseLen; pcfResponseIdx++) 
            {
                PCFParameter [] parameters = pcfResponse[pcfResponseIdx].GetParameters();
                foreach(PCFParameter pm in parameters)
                {
                    Console.WriteLine(pm.Parameter +  " - " + pm.GetValue());
                }           
            }
            messageAgent.Disconnect();
        }
        catch(MQException ex)
        {
            Console.Write(ex);
        }
    }

这篇关于从C#/。NET进行MQ统计信息监视的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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