我想获得Transmission Queue
的Queue Depth
(XMIT队列)使用。net的WebSphere MQ类,有人可以帮助我给出一个特定的链接/伪代码或。net类/API来识别XMIT队列深度。我已经浏览了。net API,但没有找到任何关于XMIT队列的信息。
您可以使用MQ . net PCF接口来查询队列属性。下面是示例代码片段:
注意: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();
}
}