There are 2 ways to close down a QueueManager.
This closes Queue Manager, specifying a delay to allow existing internal processes to finish normally. Note that this delay is only implemented as a series of 100ms pause and retry cycles. Calling this method will prevent any new activity, such as transmitting a message, from being started, but will allow activities already in progress to complete. The delay is a suggestion only, and various JVM dependant thread scheduling factors could result in the delay being greater. If the activities currently in progress finish sooner, then the method will return before the expiry of the quiesce duration.
If at the expiry of this period the queue has not closed, it is forced to close.
This method closes down the queue manager. One of the close methods should be called by WebSphere MQ Everyplace applications when they have finished using the queue manager.
After this method has been called, no more event notifications will be dispatched to message listeners. It is conceivable that messages may complete their arrival after this method has been called (and before it finishes). Such messages will not be notified. Application programmers should be aware of this, and not assume that every message arrival will generate a message event.
MQeQueueManager qmgr = new MQeQueueManager(); MQeMsgObject msgObj = null; try { qmgr.putMessage(null, "MyQueue", msgObj, null, 0); } catch (MQeException e) {// Handle the exception here } qmgr.closeQuiesce(3000); // close QMgr
This closes Queue Manager immediately. One of the close methods should be called by WebSphere MQ Everyplace applications when they have finished using the queue manager.
After this method has been called, no more event notifications are dispatched to message listeners. Messages might complete their arrival after this method has been called, and before it finishes. Such messages are not notified. Application programmers should be aware of this, and not assume that every message arrival will generate a message event.
MQeQueueManager qmgr = new MQeQueueManager(); MQeMsgObject msgObj = null; try { qmgr.putMessage(null, "MyQueue", msgObj, null, 0); } catch (MQeException e) {// Handle the exception here } qmgr.closeImmediate(); // close QMgr