Author |
Message
|
DeadHead |
Posted: Tue Jan 09, 2007 6:59 am Post subject: Gracefully stopping Java MQ app |
|
|
 Novice
Joined: 28 Sep 2006 Posts: 12
|
'Lo all,
I have a Java app running on an iSeries or AS400 that reads from a MQ queue and writes to an iSeries dataQ. Works fine, question is, how can I bring it down "gracefully" or cleanly? Any ideas or comments would be appreciated... Thanks.  _________________ "One man gathers what another man spills" GD |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Jan 09, 2007 7:01 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Code it to quit when the queue is empty, or code it to accept a special shutdown message. Search here for Feedback codes. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
DeadHead |
Posted: Tue Jan 09, 2007 8:05 am Post subject: |
|
|
 Novice
Joined: 28 Sep 2006 Posts: 12
|
jefflowrey wrote: |
Code it to quit when the queue is empty, or code it to accept a special shutdown message. Search here for Feedback codes. |
Do you mean to just send a "special" message through the MQ queue and check for it. When it is read, then close and disconnect? Thanks...  _________________ "One man gathers what another man spills" GD |
|
Back to top |
|
 |
Vitor |
Posted: Tue Jan 09, 2007 8:08 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
DeadHead wrote: |
Do you mean to just send a "special" message through the MQ queue and check for it. When it is read, then close and disconnect? Thanks...  |
Exactly so. It is one of the traditional methods. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
DeadHead |
Posted: Tue Jan 09, 2007 8:12 am Post subject: Thanks jefflowrey & Vitor for you time & help... |
|
|
 Novice
Joined: 28 Sep 2006 Posts: 12
|
 _________________ "One man gathers what another man spills" GD |
|
Back to top |
|
 |
RogerLacroix |
Posted: Tue Jan 09, 2007 10:20 am Post subject: Re: Gracefully stopping Java MQ app |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
|
Back to top |
|
 |
DeadHead |
Posted: Tue Jan 09, 2007 12:03 pm Post subject: |
|
|
 Novice
Joined: 28 Sep 2006 Posts: 12
|
Thank you Roger. Thanks to all of you...
PS You need some "new" Emoticons with an "attitude".... _________________ "One man gathers what another man spills" GD |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Jan 09, 2007 12:05 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
 _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
jsware |
Posted: Wed Jan 10, 2007 5:21 am Post subject: Re: Gracefully stopping Java MQ app |
|
|
 Chevalier
Joined: 17 May 2001 Posts: 455
|
RogerLacroix (on the other thread) wrote: |
MQ Best Practice for terminating a Get Wait Forever.
A thread / program / whatever, puts an empty message on the queue with the MQMD's Feedback set to MQFB_QUIT.
Then in your child thread that reads the queue, you put the following:
Code: |
if (msg.feedback == MQC.MQFB_QUIT)
{
return;
// or throw an exception - no message or time to quit ...
} |
|
Hey I learn't somthing today. A bit later than jeff did (see the other thread)
Thanks for the tip Roger. I'm off to incorporate this snip of code into my adapter layer... _________________ Regards
John
The pain of low quaility far outlasts the joy of low price. |
|
Back to top |
|
 |
|