Question How to change the monitoring property of a websphere MQ queue?

Amanaplan

New member
Joined
Jun 6, 2016
Messages
2
Programming Experience
10+
First time poster, long time help seeker :congratulatory:

Background:
Windows C# with reference to IBM.WEBSPHERE to access IBM Websphere MQ Queues.

Problem:
I need to alter the ?Queue monitoring? property of a MQ Queue using a C# Windows app.

Currently I can access the queues, read messages, place messages and using PCF I can list all the properties of the Queue, but am unable to identify the actual property that must be changed or how to change it.

Below is the portion of the code that list the properties and the property values of a queue:


C#:
MQEnvironment.Hostname = somehost;
MQEnvironment.Channel = somechannel;
MQEnvironment.Port = someport;
 
MQQueueManager queueManager = [COLOR=#0000ff]new[/COLOR] MQQueueManager(someQManger);
 
PCFMessageAgent messageAgent = [COLOR=#0000ff]new[/COLOR] PCFMessageAgent(queueManager);
 
PCFMessage pcfMsg = [COLOR=#0000ff]new[/COLOR] PCFMessage(MQC.MQCMD_INQUIRE_Q);[COLOR=#008000][I]//[/I][/COLOR][COLOR=#008000][I]MQC.MQOO_SET
[/I][/COLOR]
pcfMsg.AddParameter(MQC.MQCA_Q_NAME, someQueueName);
 
PCFMessage[] pcfResponse = messageAgent.Send(pcfMsg);
[COLOR=#0000ff]int[/COLOR] pcfResponseLen = pcfResponse.Length;
 
txtInfo.Clear();
txtInfo.AppendText(spar + [COLOR=#800080]"[/COLOR][COLOR=#800080]\r"[/COLOR]);
txtInfo.AppendText([COLOR=#800080]"[/COLOR][COLOR=#800080]\r"[/COLOR]);
 
[COLOR=#0000ff]for[/COLOR] ([COLOR=#0000ff]int[/COLOR] pcfResponseIdx = [COLOR=#000080]0[/COLOR]; pcfResponseIdx < pcfResponseLen; pcfResponseIdx++)
{
    PCFParameter[] parameters = pcfResponse[pcfResponseIdx].GetParameters();
    [COLOR=#0000ff]foreach[/COLOR] (PCFParameter pm [COLOR=#0000ff]in[/COLOR] parameters)
    {
        txtInfo.AppendText([COLOR=#800080]"[/COLOR][COLOR=#800080]Type = "[/COLOR] + pm.Type.ToString() + [COLOR=#800080]"[/COLOR][COLOR=#800080]\t"[/COLOR] + [COLOR=#800080]"[/COLOR][COLOR=#800080]Parameter = "[/COLOR] + pm.Parameter + [COLOR=#800080]"[/COLOR][COLOR=#800080]\t"[/COLOR] + [COLOR=#800080]"[/COLOR][COLOR=#800080]Value = "[/COLOR] + pm.GetValue() + [COLOR=#800080]"[/COLOR][COLOR=#800080]\r"[/COLOR]);
    }
}
messageAgent.Disconnect();

Output:

Type = 4 Parameter = 2016 Value = BRK.ASSESSMENTMANAGEMENT.EXPIRY
Type = 3 Parameter = 20 Value = 1
Type = 3 Parameter = 134 Value = -3
Type = 4 Parameter = 2027 Value = 2016-02-03
Type = 4 Parameter = 2028 Value = 06.48.44
Type = 4 Parameter = 2019 Value =
.....etc.


Some advice, guidance and possibly code to help me please.

What I have tried:

Everything I can think of.....
Read various online forums.
Tried code (java incl) that I found on forums.
Studied the IBM knowledge base.
Experimented with code.
Messed up queue data...received a written warning...
Praying..
Duck and diving my boss

 
Solution:

MQEnvironment.Hostname = somehost;
MQEnvironment.Channel = somechannel;
MQEnvironment.Port = someport;

MQQueueManager queueManager = new MQQueueManager(someQManger);

PCFMessageAgent messageAgent = new PCFMessageAgent(queueManager);

PCFMessage pcfMsg = new PCFMessage(MQC.MQCMD_CHANGE_Q);
pcfMsg.AddParameter(MQC.MQCA_Q_NAME, someQueueName);
pcfMsg.AddParameter(MQC.MQIA_Q_TYPE, MQC.MQQT_LOCAL);
pcfMsg.AddParameter(MQC.MQIA_MONITORING_Q, MQC.MQMON_LOW);

PCFMessage[] pcfResponse = messageAgent.Send(pcfMsg);
messageAgent.Disconnect();
 
Last edited:
Back
Top Bottom