Author |
Message
|
sahas |
Posted: Thu Jan 03, 2008 6:51 am Post subject: Getting Curdepth from MQMD header |
|
|
Newbie
Joined: 11 Apr 2006 Posts: 4
|
Hi,
There are 10 messages in the local queue. I want to get the Curdepth of the queue using ESQL.
Can I get the curdepth attribute in the MQMD header. If not anyone help me in this regard as to how to get the curdepth using ESQL?
Thanks and Regards,
Srikanth. |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Jan 03, 2008 6:54 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Nope.
You can't do this, and... you don't want to.
It's a really bad idea, almost certainly. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Jan 03, 2008 7:05 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
You would need to send a PCF message requesting the curdepth attribute.
Be aware however that the reply to message may not be unique...
Could you elaborate as to why you need this attribute???
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
sahas |
Posted: Thu Jan 03, 2008 7:14 am Post subject: |
|
|
Newbie
Joined: 11 Apr 2006 Posts: 4
|
We are going for a retry mechanism. We are using MQ Get node to retrieve the message from a queue. But MQ Get node is getting only the first message. Before MQ Get node We are using TimeOutControl Node and gave some 30 min. Fo every 30 min the MQGet node will pick up the first message from the queue. Within 30 min there could be many other messages sitting on the queue. So, If only the first message is picked up from the queue then the rest of the messages will be on the queue itself and wait for very long time for their turn.
In order to resolve this problem, we want to get the curdepth of the queue for every 30 min and loop the flow to process all the messages. |
|
Back to top |
|
 |
bower5932 |
Posted: Thu Jan 03, 2008 7:49 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
Couldn't you just use a message flow that processed all of the messages all of the time? |
|
Back to top |
|
 |
fschofer |
Posted: Thu Jan 03, 2008 7:58 am Post subject: |
|
|
 Knight
Joined: 02 Jul 2001 Posts: 524 Location: Mainz, Germany
|
Hi,
you can simply loop the MQGet node + some procesing within the flow until it sends something out to the 'no message' terminal.
Greetings
Frank |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Jan 03, 2008 7:59 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Just loop until the MQGet exits out the "no more messages" terminal.
I.e. until it returns the equivalent of a 2033.
Upstream of MQGet, put an esql that does something like
while sharedVariableFlagForNoMoreMessages is false
propagate to MQGet
end while
and attach a compute node to MQGet no more messages terminal that sets sharedVariableFlagForNoMoreMessages to false. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
sahas |
Posted: Thu Jan 03, 2008 8:08 am Post subject: |
|
|
Newbie
Joined: 11 Apr 2006 Posts: 4
|
Thanks everyone.
I will try this logic but I am having a doubt here. Once the message is taken from the queue it will be processed and if it got failed again then it will come to the same queue and where the flow is still looping and get this message again. So, I feel it may go into continuous loop. But anyway I will check and update you regarding this.
Thanks and Regards,
Srikanth. |
|
Back to top |
|
 |
David.Partridge |
Posted: Fri Jan 04, 2008 3:02 am Post subject: |
|
|
 Master
Joined: 28 Jun 2001 Posts: 249
|
That is what backout queues and backout count are there for, so if you roll back a poison message more than "n" times, you push it over the the backout queue. _________________ Cheers,
David C. Partridge |
|
Back to top |
|
 |
zpat |
Posted: Fri Jan 04, 2008 4:47 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
You don't need to use PCF to enquire on queue attributes including current depth.
You can simply open a queue for inquire and use the MQINQ call.
Application programs are not really meant to use system management functions like PCF.
Not sure if WMB implements MQINQ and I can't really see why it would be needed. As stated above look at the MQMD.Backout value.
However MQINQ is useful to extract the backout requeue count threshold and backout re-queue queue name if you want to do the thing by the book. |
|
Back to top |
|
 |
sunny_30 |
Posted: Mon Jan 07, 2008 5:13 pm Post subject: |
|
|
 Master
Joined: 03 Oct 2005 Posts: 258
|
Sahas,
You can write an external Java function that enquires a Queue for depth.
eg:
int openOptions = MQC.MQOO_INQUIRE ;
que = qMgr.accessQueue(qname, openOptions);
curDepth = que.getCurrentDepth();
The java function can later be called from ESQL like below:
CREATE FUNCTION QueueDepth(IN qmanager CHAR, IN queue CHAR) RETURNS INTEGER
LANGUAGE JAVA
EXTERNAL NAME "QueueDepth.getQueueDepth";
-Sunny |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Jan 08, 2008 7:42 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
sunny_30 wrote: |
You can write an external Java function that enquires a Queue for depth. |
But that's a really bad idea. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
sunny_30 |
Posted: Tue Jan 08, 2008 12:55 pm Post subject: |
|
|
 Master
Joined: 03 Oct 2005 Posts: 258
|
Jeff,
Is enquiring a queue for the curdepth a bad-idea? OR
Is writing an External Java procedure to do that a bad idea?
Will there be any problems if Java procedures are called from ESQL?
-Sunny |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Jan 08, 2008 1:05 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
It's a bad idea to make any business application decisions based on queue depth.
It's a bad idea.. in general... to do anything with MQ from Java in broker, unless you're very very careful, as you might interefer with the Broker's normal MQ operations - either by messing up the connection, or by interfering with the transaction or etc. etc. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
|