|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
MQCFOP_LIKE add multiple filter |
« View previous topic :: View next topic » |
Author |
Message
|
vasilev |
Posted: Sat Jan 16, 2021 12:00 pm Post subject: MQCFOP_LIKE add multiple filter |
|
|
 Acolyte
Joined: 31 Oct 2014 Posts: 71 Location: Germany
|
Hello dear all,
I want to add a filter for displaying the queues with Java.
First i am adding :
msg.addFilterParameter(CMQC.MQIA_CURRENT_Q_DEPTH, CMQCFC.MQCFOP_GREATER, 0);
to display only queues that are not empty and second i want to add additional filter to display only queues matching QL1.* , QL2.* for example:
PCFMessage msg = new PCFMessage (CMQCFC.MQCMD_INQUIRE_Q_STATUS);
msg.addParameter(CMQC.MQCA_Q_NAME, "*");
msg.addFilterParameter(MQConstants.MQCA_Q_NAME, CMQCFC.MQCFOP_LIKE, "QL1.*");
msg.addFilterParameter(MQConstants.MQCA_Q_NAME, CMQCFC.MQCFOP_LIKE, "QL2.*");
msg.addParameter(CMQCFC.MQIACF_Q_STATUS_TYPE, CMQCFC.MQIACF_Q_STATUS);
msg.addParameter(CMQC.MQIA_Q_TYPE, CMQC.MQQT_LOCAL);
when i specify MQCFOP_LIKE - it is giving all queues. seems that the filter is not working or not valid. I have tried also with one filter - same.
Can you help me to understand if all is fine with the filter or syntax is wrong.
thank you ! _________________ Regards
V.Vasilev |
|
Back to top |
|
 |
hughson |
Posted: Sun Jan 17, 2021 2:11 pm Post subject: |
|
|
 Padawan
Joined: 09 May 2013 Posts: 1959 Location: Bay of Plenty, New Zealand
|
You can only add one filter when using the native MQ WHERE clause as you are doing (the same thing in MQSC has a parameter called WHERE so you will hear this referred to as the "WHERE clause").
Luckily the other thing you want to "filter" on is the object name, so just put the generic name, that is QL1.* into the MQCA_Q_NAME parameter instead of the * you currently have there.
If you are trying to have a single command finding queues that are either QL1.* or QL2.* and have a non-zero depth, you cannot do that with a single command in native MQ interfaces.
<vendor-plug>
It is however possible to achieve this with a single command using MQSCX from MQGem Software. With that tool, you can issue the following command:-
Code: |
DISPLAY QLOCAL(*) =where(CURDEPTH GT 0 AND (QUEUE LK "QL1.*" OR QUEUE LK "QL2.*")) |
</vendor-plug>
Cheers,
Morag _________________ Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software |
|
Back to top |
|
 |
vasilev |
Posted: Mon Jan 18, 2021 1:39 am Post subject: |
|
|
 Acolyte
Joined: 31 Oct 2014 Posts: 71 Location: Germany
|
Thank you, Morag!
I didn't believe that somebody will answer here because it is the wrong subforum (i understood this after I submitted .. and couldn't delete it after that )
I have achieved this with a loop..
Code: |
for(String q:partsQ){
try {
PCFMessage msg = new PCFMessage (CMQCFC.MQCMD_INQUIRE_Q_STATUS);
msg.addParameter(CMQC.MQCA_Q_NAME, q);
.
.
.
|
as a request, I have:
java -.. jar "QL.*;APP1.*"
as a result, I have something like:
Code: |
{
"VMQSRV": {
"QL.1": {
"CURDEPTH": 1,
"MESSAGECALC": "0 days,13 hours,5 minutes, 58 seconds.",
"MESSAGEAGE": 47158,
"ALERTON": 100
},
"APP1.TO.APP2": {
"CURDEPTH": 2,
"MESSAGECALC": "1 days,12 hours,58 minutes, 16 seconds.",
"MESSAGEAGE": 133096,
"ALERTON": 100
}
}
} |
I am creating a monitoring solution and that is why I need to configure it with some limit, depends on client needs. _________________ Regards
V.Vasilev |
|
Back to top |
|
 |
hughson |
Posted: Mon Jan 18, 2021 1:32 pm Post subject: |
|
|
 Padawan
Joined: 09 May 2013 Posts: 1959 Location: Bay of Plenty, New Zealand
|
So you are issuing multiple commands and gathering together the total of all the results.
Remember that there are many monitoring solutions already out there. You may not need to write one from scratch to meet your needs.
I would be interested in hearing about your monitoring needs.
Cheers,
Morag _________________ Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software |
|
Back to top |
|
 |
RogerLacroix |
Posted: Mon Jan 18, 2021 3:03 pm Post subject: |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
|
Back to top |
|
 |
vasilev |
Posted: Tue Jan 19, 2021 1:33 am Post subject: |
|
|
 Acolyte
Joined: 31 Oct 2014 Posts: 71 Location: Germany
|
Hello,
no, for the queue percentage full, I am using the same code from Roger (thank you Roger), just simplified it a little bit and added additional parameters for the percentage threshold. In this way, the client can configure this percentage with a command input.
Also, change input/output to be json as it is easier.
This is for pcf read max queue depth, current queue depth.
for the other - message age, i am using also another sample:
Code: |
msg.addParameter(CMQCFC.MQIACF_Q_STATUS_TYPE, CMQCFC.MQIACF_Q_STATUS);
msg.addParameter(CMQC.MQIA_Q_TYPE, CMQC.MQQT_LOCAL);
msg.addParameter(CMQCFC.MQIACF_Q_ATTRS, new int [] {
CMQC.MQCA_Q_NAME,
CMQC.MQIA_CURRENT_Q_DEPTH
});
msg.addFilterParameter(CMQC.MQIA_CURRENT_Q_DEPTH, CMQCFC.MQCFOP_GREATER, 0);
PCFMessage[] responses = agt.send(msg);
for (int i = 0; i < responses.length; i++)
{
if ( ((responses[i]).getCompCode() == CMQC.MQCC_OK) &&
((responses[i]).getParameterValue(CMQC.MQCA_Q_NAME) != null) )
{
var q = (String)responses[i].getParameterValue(MQConstants.MQCA_Q_NAME);
queue = qmgr.accessQueue (q, CMQC.MQOO_INPUT_AS_Q_DEF | CMQC.MQOO_BROWSE | CMQC.MQOO_FAIL_IF_QUIESCING);
MQMessage message = new MQMessage ();
MQGetMessageOptions gmo = new MQGetMessageOptions ();
gmo.options = CMQC.MQGMO_BROWSE_FIRST | CMQC.MQGMO_NO_WAIT | CMQC.MQGMO_CONVERT;
message.messageId = null;
message.correlationId = null;
queue.get (message, gmo);
GregorianCalendar cal = message.putDateTime;
long ageInMillis = new java.util.Date().getTime() - cal.getTime().getTime();
int ageInSeconds = (int) ageInMillis/1000; |
I didn't find some other that is better than this for getting the message put date.
To get the data from all Qmanagers running on the same server, I am making a bash script taking and grepping the running QM in an array.
For the monitoring solutions - yes, I am already using filebeat with MQ JSON logs and all is fine there.
Just wanted to add one additional monitoring for percentage and message age...
So if there is a queue, full more than client configured or message that stay longer in the queue than client configured - it makes a post request to our middleware tool, who is opening a request in Jira, Email notification, HPSM, Service now, or whatever request solution the client has configured. _________________ Regards
V.Vasilev |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Jan 19, 2021 5:44 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Monitoring for oldest message age is much easier. You will get this information in the queue status if the MONQ attribute is set to LOW or higher.  _________________ MQ & Broker admin |
|
Back to top |
|
 |
hughson |
Posted: Wed Jan 20, 2021 9:19 pm Post subject: |
|
|
 Padawan
Joined: 09 May 2013 Posts: 1959 Location: Bay of Plenty, New Zealand
|
vasilev wrote: |
So if there is a queue, full more than client configured or message that stay longer in the queue than client configured - it makes a post request to our middleware tool, who is opening a request in Jira, Email notification, HPSM, Service now, or whatever request solution the client has configured. |
You should use MQ Events for those two cases, Queue High and Queue Service Interval High, rather than constantly polling the queue manager on the off chance that one of these situations has happened.
Cheers,
Morag _________________ Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|