artem
artem

Reputation: 25

Correct stop java application with IBM mq

I use java application with IBM mq websphere. When i am killing the application in mq is remained some information about channels. I don't know way to correct stopping of application.

Simply put, i need kill application with mq channels. Because when i restart application, it can't start and throw exception:

ERROR Failed to initialize Queue Channel.
com.ibm.msg.client.jms.DetailedJMSException: JMSWMQ0018: Failed to connect to queue manager 'TL4UZ8T' with connection mode '1' and host name 'mq4u-TL4UZ8T.lb.com(64424)'.

Thanks for helping!

Upvotes: 1

Views: 1662

Answers (2)

T.Rob
T.Rob

Reputation: 31832

To expand on Shashi's excellent answer, there are lots of things you can consider here. For example:

  • Stop the channel before killing the application. Even if you have dozens of running channel instances, you can stop the ones associated with that particular IP address. Use MODE(INACTIVE) so the app can reconnect.
  • Stop the channel after killing the application. As before, you can stop the ones associated with that particular IP address.
  • Instrument the application to accept shutdown commands on a queue, then shut itself down gracefully.
  • Disable the application's queue(s). When an application isn't instrumented well, chances are it perceives disabling its queues as fatal and will shut itself down when you do so.
  • Tune the channel's HBINT, SHARECONV, KEEPALIVE and other parameters so that the channel has lots of spare instances and that the orphaned instances shut down in a timely fashion. This may include bumping up the listener backlog as well.
  • Instrument the application to accept SIGHUP or other system signal to shut itself down gracefully.

As Shashi notes, the best option is that the application communicates it's desire to shut down to the QMgr and the two cooperate to accomplish that task. The app is built to cooperate with MQ on every other task, so why not this one?

However, if that isn't an option use the instrumentation built into MQ to accomplish as close as possible to the desired result.

Failing that, use the instrumentation built into the OS but tune MQ to minimize the impact.

Upvotes: 1

Shashi
Shashi

Reputation: 15263

Boy! why you have to kill application? Do you mean abnormal termination of application?

The application must call Disconnect() to inform the queue manager to do clean up it's end. It's a best practice, please read other best practices here. If Disconnect is not called, queue manager does not immediately clean up resources allocated for a client connection.

So check your application code and ensure it has code to close any queues/topics/connections opened.

Upvotes: 1

Related Questions