Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MQSeries problem between a c prog. and the message queue

Status
Not open for further replies.

Codewarior

Programmer
Nov 15, 2001
1
FR
Hello, I am a programmer aked to do some work on a c program that deals with MQSeries.
I'm in need of help and advice.

Background:
I am working on a C program that is called by an MQ Series trigger.
This program is run on NT 4.0 and processes data from an oracle 8 server, thru MQ Series messages, to send them to an SQL server.
It essentially connects to it and mqGets messages waiting in MQ's message queue. For testing purposes, there's about 5 msgs (messages) waiting.
These msgs are then retreived from MQ one at a time, processed and the program should quit.
No loops and no objects, this program is sequentially coded with some procedures.
To run the program, I start a pl/sql script wich starts some oracle triggers wich, in turn, starts some MQ triggers.
To debug, I have coded a bunch of fprintf statements into a file.
The MQ series coded statements are simple and have fprintf msgs in case any of them fail.

Symptom:
When I run the program, It appears in the NT process manager so it is running.
Then I check the message queue in MQ Series: it has 4 out of 5 messages just sitting there waiting to be processed.
That's it.

Problem:
My program remains in memory, forever working but never shuts down.
My debug file remains open at 0 kb with nothing written to it.
The 1st message to be processed doesn't appear in the queue, but the other 4 do and remain there.
I am supposed to at least have some strings printed into my debug file to follow program's run.
Can anyone explained why my C program doesn't simply take each MQ messages to process and shut down???

Clues:
If it helps, to get anything done, I stop the trigger monitor, wait 5 sec, restart it.
I then see for 1/2 sec a second instance of my program appear in NT's process manager then disappear.
I then have a debug file with some printed statements for the 2nd message (not the 1st).
The 3 other msgs are still waiting in the queue.
One instance of my program is still running in memory.

Thank you to anyone who shed some light on this... a C/C++ programmer not an MQ Series admin...

 
Your C program launched by the trigger monitor should do the following:

main() {
MQCONN()
MQOPEN()
do {
MQGET()
if (RC == MQRC_NO_MSG_AVAILABLE) break;
else process_message;
}
MQCLOSE()
MQDISC()
}

Things to check:
- Make sure you are using TRIGGER(FIRST) on the application queue
- After the first MQGET, your MQMD will have the MsgId and CorrelId of the first message. Make sure you are not trying to match these on subsequent MQGETS
- Make sure you are not specifying an unlimited wait on the MQGET (a short interval is often best for performance reasons)

If this doesn't help, post the MQ bit of your code and we'll take a look.

Cheers,
Paul
 
Also, to add to above, make sure when you created the queue manager you have specified a good trigger interval. Also, the oracle trigger does a PUT on the queue in a UOW ?
MiddlewareOnline.com IBM MQ Series Certified Consultants
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top