如何通过示例消息检查MQ是否启动或关闭 [英] How can I check if the MQ is up or down with sample message

查看:82
本文介绍了如何通过示例消息检查MQ是否启动或关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在使用以下代码来检查MQ Manager upstatus.

Hi,
I am using the following code to check for MQ Manager upstatus.

IBM.WMQ.MQQueueManager lObjMQManager = new IBM.WMQ.MQQueueManager(lStrQueueManagerName, lStrChannelName, lStrConnName);
                    if (lObjMQManager.OpenStatus == true)
                    {
                        lBoonIsConnected = true;
                        lObjMQManager.Disconnect();
                        lObjMQManager.Close();
                        lObjMQManager = null;
                    }
                    else
                    {
                        lBoonIsConnected = false;
                    }


但是我想知道队列是否启动.我怎么能做到这一点.有没有我可以发送和检查的示例消息,如下所示...


But I want to know whether Queue is up or not. How can I achive this. Is there any sample message that I can send and check like below…

lObjQueue.Put(lObjQueueMessage, lObjQueuePutMessageOptions);


有什么办法吗..
请帮忙.
谢谢
Sreenath


is there any way for this..
Please help.
Thanks
Sreenath

推荐答案

我建​​议您为队列调用CreationDateTime属性,因为我认为如果队列已死,则会抛出MQException错误

I would suggest that you call the CreationDateTime property for the queue, as I believe that if the queue is dead it will throw a MQException error

try
{
  DateTime t = lObjQueue.CreationDateTime;
  ...
}
catch(MQException ex)
{
  // Log error
  ... 
}


这篇关于如何通过示例消息检查MQ是否启动或关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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