Author |
Message
|
gpklos |
Posted: Tue Aug 05, 2008 5:54 am Post subject: How to End a Get w/wait before the wait interval? |
|
|
Centurion
Joined: 24 May 2002 Posts: 108
|
I have a coder that is running a program as a windows service. In his program he has one thread which is doing a GET w/wait for 60 seconds. Now if the Windows Service is stopped (they are doing this via a batch file), he has a second thread which catches the request to stop the program. At this point he wants to close the queue that has the GET w/wait happening on it. He tries to do it with the second thread but the GET w/wait won't let him close the queue. So basically he has to wait for the entire minute before the service stops. Is there some way he can force the GET w/Wait to end prematurely from the second thread, so that the he can disconnect and end the service instead of waiting for the get to end?
Thank you very much,
Gary |
|
Back to top |
|
 |
David.Partridge |
Posted: Tue Aug 05, 2008 6:01 am Post subject: |
|
|
 Master
Joined: 28 Jun 2001 Posts: 249
|
Yes, change the code so that it does the get/wait with MQGMO_FAIL_IF_QUIESCING. When you go to close the QM the get will fail with reason MQRC_Q_MGR_QUIESCING. _________________ Cheers,
David C. Partridge |
|
Back to top |
|
 |
David.Partridge |
Posted: Tue Aug 05, 2008 6:02 am Post subject: |
|
|
 Master
Joined: 28 Jun 2001 Posts: 249
|
Ooops - this wasn't QM shutddown scenario.
So, change the code so you use a shorter wait interval of (e.g.) five seconds). This is still an eternity in computer time. _________________ Cheers,
David C. Partridge |
|
Back to top |
|
 |
Michael Dag |
Posted: Tue Aug 05, 2008 6:14 am Post subject: |
|
|
 Jedi Knight
Joined: 13 Jun 2002 Posts: 2607 Location: The Netherlands (Amsterdam)
|
|
Back to top |
|
 |
gpklos |
Posted: Tue Aug 05, 2008 6:34 am Post subject: |
|
|
Centurion
Joined: 24 May 2002 Posts: 108
|
I did suggest to the applications before I posted to have the 2nd thread put a "stop" message to the queue. Unless there is another way, that is more than likely the way the application will go. We want them to have a wait interval that is high enough because they are polling, not triggering. Originally they had it set up to poll every 1 second with no wait. Obviously this is a resource problem, so I told them to figure an "ideal" wait time and that is when they ran into this problem.
Thanks for the suggestions,
Gary |
|
Back to top |
|
 |
bruce2359 |
Posted: Tue Aug 05, 2008 6:46 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
If memory serves... setting the queue get-inhibited will terminate the get-wait. _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
gpklos |
Posted: Tue Aug 05, 2008 7:02 am Post subject: |
|
|
Centurion
Joined: 24 May 2002 Posts: 108
|
Now that I didn't think of. Probably because we don't let our application programmers have access to change the queue attributes. However that at least gives me the option to provide a program for them that would do that, if they don't want to put a "STOP" message on the queue.
Thanks,
Gary |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Aug 05, 2008 7:30 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
There is an MQMD.Feedback field specifically for "STOP" messages. |
|
Back to top |
|
 |
bruce2359 |
Posted: Tue Aug 05, 2008 7:36 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
Quote: |
There is an MQMD.Feedback field specifically for "STOP" messages. |
But applications must be coded to understand it and take appropriate action (inaction). There is also an equivalent fb for ack and nack. _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
|