Thanks, David. As I said, the problem is that, due to
the nature of business, these apps will be running all
the time (i.e. they will almost never stop except for
app maintenance etc.) Most of the time they may be
sitting around doing absolutely nothing. So, unless
they issue an MQI call (e.g. MQGET) on a regular basis
(every 15-30 sec whatever) during the idle time, they
won't be able to detect the queue manager coming down.
I think that's what we will do.
Thanks for the all responses.
Steve
--- "David C. Partridge" <[EMAIL PROTECTED]>
wrote:
> Yes, it most certainly can.
>
> Unless the application is sitting in an MQGET wait
> or happens to issue an
> MQI verb at the time the QM is closing down, it
> won't notice this is
> happening. The result will be that you won't be
> able to close the QM
> tidily.
>
> The approach that the CHIN uses, and I have also
> adopted is to create a TD
> queue as the application starts and spin a thread
> which sits on an MQGET
> with infinite timeout. When the application is
> closing it puts a message
> to the TD queue which satisfies the MGET and the
> thread terminates. If the
> queue manager is closing the MQGET wait fails and
> the same sort of logic
> applies.
>
> Code snippet (in Java) follows:
>
> if (!monitor.mqClosing &&
> !monitor.shouldStop)
> {
> try
> {
> queue.get(msg, gmo);
> Trace.trace(this, "Termination
> message received");
>
> //
> // If we read a message, we should
> stop now
> //
> monitor.shouldStop = true;
> }
> catch (MQException e)
> {
> //
> // If the reason for the
> MQException was that the queue
> // manager is being closed down,
> tell our invoker that
> this
> // is the case. If the error was
> NOT no message available
> // we have a problem, so rethrow
> the exception.
> //
> if
> (MQException.MQRC_Q_MGR_QUIESCING == e.reasonCode ||
>
> MQException.MQRC_Q_MGR_STOPPING == e.reasonCode ||
>
> MQException.MQRC_CONNECTION_QUIESCING ==
> e.reasonCode
> ||
>
> MQException.MQRC_CONNECTION_STOPPING == e.reasonCode
> ||
>
> MQException.MQRC_CONNECTION_BROKEN == e.reasonCode)
> {
> monitor.mqClosing = true;
> }
> else if
> (MQException.MQRC_NO_MSG_AVAILABLE !=
> e.reasonCode)
> {
> Trace.trace(this,
> "MQException caught reason = "
> + e.reasonCode);
> throw e;
> }
> }
> } // if (!monitor.mqClosing &&
> !monitor.shouldStop)
> Trace.trace(this, "Closing and
> deleting queue " +
> dynamicQueueName);
> try {queue.close();}
> catch (MQException mqe) {}
> }
>
> Dave
>
> Instructions for managing your mailing list
> subscription are provided in
> the Listserv General Users Guide available at
> http://www.lsoft.com
> Archive: http://vm.akh-wien.ac.at/MQSeries.archive
__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com
Instructions for managing your mailing list subscription are provided in
the Listserv General Users Guide available at http://www.lsoft.com
Archive: http://vm.akh-wien.ac.at/MQSeries.archive