Author |
Message
|
klamerus |
Posted: Sat Jun 11, 2005 2:42 pm Post subject: Sample MS VC/C++ using PCF |
|
|
 Disciple
Joined: 05 Jul 2004 Posts: 199 Location: Detroit, MI
|
We've gotten really frustrated trying to make use of the PCF interface from MS Visual C/C++ on Windows to check on the # of dequeues on a queue.
We need to create some code that will run in a loop. Each loop it needs to see if the there are messages in each of several different queues, and if there are to see if there have been any dequeues on that queue.
If we still have messages on the second iteration (which will include a sleep at the end), then we know that the program that's supposed to be reading messages off of the queue isn't working properly.
Unfortunately, that program gets hung and we can't do anything about it except restart it.
We need to run this on one of our Windows 2000 servers and check the queues on it, plus 2 other servers.
Can anyone provide a sample bit of coding doing this? We'd pay (via paypal or something) to just get a sample that works doing this on someone else's system with their own queues. The real thing we don't know how to do is use PCF to read dequeues and we can't find any samples or starters on this. |
|
Back to top |
|
 |
fjb_saper |
Posted: Sat Jun 11, 2005 3:42 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
If you are just looking for examples and pcf syntax check out MS0B support pack.
I know it's Java and not C /C++ but maybe the documentation given with it may help you along. And this stuff is from IBM MQ Support packs so its free!!
Enjoy  |
|
Back to top |
|
 |
bower5932 |
Posted: Sat Jun 11, 2005 5:53 pm Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
Before I'd write a program that checked a whole bunch of queues to see what their depth may be, I'd consider looking into some of the event messages that WMQ can send. You might be better off having WMQ send you a message that triggered your application when the depth reached a certain point. |
|
Back to top |
|
 |
RogerLacroix |
Posted: Sat Jun 11, 2005 9:47 pm Post subject: |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
Hi,
Unless you are writing your own monitoring program, you should seriously asked yourself or the architect - why?
But if you are writing your own home-grown monitoring program then why not use the MQINQ function for C (or C++ isn't there a getCurrentDepth function).
There are C code samples of this at my web site:
http://www.capitalware.biz/mq_code_c.html
And if you really insist on doing PCF then why not use the PCF wrapper call MQAI?? Again, there is a good sample at my web site call QStatus.
Regards,
Roger Lacroix
Capitalware Inc. _________________ Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter |
|
Back to top |
|
 |
klamerus |
Posted: Mon Jun 13, 2005 9:58 am Post subject: Homegrown yes |
|
|
 Disciple
Joined: 05 Jul 2004 Posts: 199 Location: Detroit, MI
|
Yes, this is for a home grown monitor.
Queue depth won't work since the queues can actually get quite deep and everything still be working just fine.
We need to know if they get too deep (because it may suggest some sort of serious slowdown).
We also need to know that work is flowing, so we need to check that dequeues are happening if there are items in the queue.
I'll definitely take a look at your site.
BTW, we have been playing with MQ Visual Edit and like it pretty well. We're trying to get the project approved to buy for the team and to wrap with the support procedures we need. So, to put in a blatant plug I would recommend it to others. |
|
Back to top |
|
 |
klamerus |
Posted: Mon Jun 13, 2005 10:02 am Post subject: Queue statistics |
|
|
 Disciple
Joined: 05 Jul 2004 Posts: 199 Location: Detroit, MI
|
How would you get queue statistics with this?
We need to get the # of dequeues. |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Jun 13, 2005 10:06 am Post subject: Re: Queue statistics |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
klamerus wrote: |
How would you get queue statistics with this?
We need to get the # of dequeues. |
A quick pop through the Programmable Command Formats and Administration Interface manual suggests to me that you would mqExecute with the MQCMD_RESET_Q_STATS command. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
RogerLacroix |
Posted: Mon Jun 13, 2005 1:48 pm Post subject: |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
Yes, if use QStatus program as a sample, then substitute MQCMD_RESET_Q_STATS for MQIACF_Q_HANDLE, you would be 90% of the way home.
Regards,
Roger Lacroix
P.S. Thanks for the MQ Visual Edit plug. _________________ Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter |
|
Back to top |
|
 |
klamerus |
Posted: Mon Jun 13, 2005 5:01 pm Post subject: Which DLLs |
|
|
 Disciple
Joined: 05 Jul 2004 Posts: 199 Location: Detroit, MI
|
So, which DLLs do I need for this puppy? |
|
Back to top |
|
 |
klamerus |
Posted: Mon Jun 13, 2005 5:09 pm Post subject: |
|
|
 Disciple
Joined: 05 Jul 2004 Posts: 199 Location: Detroit, MI
|
|
Back to top |
|
 |
klamerus |
Posted: Mon Jun 13, 2005 5:24 pm Post subject: |
|
|
 Disciple
Joined: 05 Jul 2004 Posts: 199 Location: Detroit, MI
|
Well, I figured I would try the vanilla QStatus first (no changes) and I'm getting the message "No processes have queue Test1 open".
I'm not familiar with the syntax of the arguments to this program though.
My machine/laptop that I'm testing on is called pikachu (I'm not kidding).
The queue manager is the default from the MQ install, which is QM_pikachu.
The queue I wanted to test on is Test1.
Can you give me the syntax to use with this program. |
|
Back to top |
|
 |
bower5932 |
Posted: Mon Jun 13, 2005 6:44 pm Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
I think the program 'worked' for you. qstatus checks to see who has the queue open and in what mode. I'd suggest that you start up amqsput and amqsget in a couple of command prompt windows and try running it again. |
|
Back to top |
|
 |
klamerus |
Posted: Tue Jun 14, 2005 5:14 am Post subject: |
|
|
 Disciple
Joined: 05 Jul 2004 Posts: 199 Location: Detroit, MI
|
I think you're right. I studied the code a bit further and it seems to be working as designed, but I don't think nearly close enough to what we need.
I'll continue tinkering, but I'll also go back to my original request and ask again for a sample. We don't have much budget, but I can offer $200 (paid by a means of the suppliers choice) to a sample that demonstrates what we're looking for.
What the sample needs to do is check with a queue or two on another system for the number of dequeues since the last check (all in a loop). Ideally, with the variables for server, queue manager, and queue parameterized such that they can be switched to check on several. |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Jun 14, 2005 5:18 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You get the dequeue rate of a queue by issuing Reset Queue Statistics, and that gives you the number of messages that were dequeued since the last time Reset Queue Statistics was run.
You do not get it from Queue Status.
jefflowrey wrote: |
A quick pop through the Programmable Command Formats and Administration Interface manual suggests to me that you would mqExecute with the MQCMD_RESET_Q_STATS command. |
RogerLacroix wrote: |
Yes, if use QStatus program as a sample, then substitute MQCMD_RESET_Q_STATS for MQIACF_Q_HANDLE, you would be 90% of the way home. |
_________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
klamerus |
Posted: Tue Jun 14, 2005 1:51 pm Post subject: |
|
|
 Disciple
Joined: 05 Jul 2004 Posts: 199 Location: Detroit, MI
|
From my end, I know that we get the dequeue rate by doing the reset on the queue stats. We can keep track of the value returned between cycles of our loop and comparing the two become aware of any real work being done (actually if we reset, any value > 0 means that work is being done).
What we don't know how to do is use this command and we're looking for a sample with the associated code that makes a working sample. |
|
Back to top |
|
 |
|