To avoid the problems associated with message consumer objects in the publish/subscribe domain not closing gracefully, WebSphere MQ JMS supplies a consumer cleanup utility that attempts to clean up the resources associated with a consumer that has failed. This utility runs in the background and does not affect other WebSphere MQ JMS operations. If the utility detects a large number of problems associated with a given queue manager, you might see some performance degradation while resources are being cleaned up.
If applications use the domain independent classes, the cleanup utility is invoked only if the applications perform publish/subscribe operations, such as creating a Topic object, or creating a MessageConsumer object with a Topic object retrieved from a JNDI namespace. This is to prevent the cleanup utility from being invoked in an environment in which applications are performing only point-to-point operations.
The exact behavior of the cleanup utility depends on where the subscription store is located:
The cleanup utility uses the information in the queues, SYSTEM.JMS.ADMIN.QUEUE and SYSTEM.JMS.PS.STATUS.QUEUE, to detect nondurable message consumers that have failed previously. If it finds a failed consumer, the utility cleans up the resources associated with the consumer by de-registering the consumer from the broker and deleting its consumer queue, provided it is not a shared queue, and any unconsumed messages on the queue.
The cleanup utility uses information in the queue, SYSTEM.JMS.REPORT.QUEUE (the messages in this queue are typically report messages from the publish/subscribe broker), to perform any necessary cleanup. This might involve deleting consumer queues and unconsumed messages that are no longer required.
Two properties of a ConnectionFactory object control the behavior of the cleanup thread: CLEANUPINT and CLEANUP. CLEANUPINT determines how often, in milliseconds, the cleanup utility is run against any given queue manager. CLEANUP has four possible values:
The cleanup thread tries to delete any consumer queues and unconsumed messages that are no longer required. This mode of cleanup does not interfere with the operation of other JMS applications.
This mode of cleanup can interfere with the operation of JMS applications running with later versions of WebSphere MQ JMS. If multiple JMS applications are using the same queue manager, but using different versions of WebSphere MQ JMS, only applications using the most recent version of WebSphere MQ JMS must use this option.
This option can be useful if the application and the queue manager are on a different systems, especially if the application only sends messages and does not receive them. At some time, however, cleanup must be initiated to delete consumer queues and unconsumed messages that are no longer required. This can be done by a JMS application that uses a ConnectionFactory object with the property CLEANUP(SAFE) or CLEANUP(STRONG), or by using the manual cleanup utility, which is described in Manual cleanup.
This property can be set on the Java command line by using the -D option. Its value can be SAFE, STRONG, or NONE. Any other value causes an exception. If the property not set, its value defaults to SAFE.
This option allows you to change the mode of cleanup within an entire JVM without having to update every ConnectionFactory object. This is useful for applications or application servers that use multiple ConnectionFactory objects.
If multiple Connection objects for the same queue manager exist within a JVM, but the Connection objects use different values for the CLEANUPINT and CLEANUP properties, the following rules determine the behavior of the cleanup utility:
If you use a broker based subscription store, you can operate the cleanup utility manually from the command line. Here is the syntax of the command:
Cleanup [-m <qmgr>] [-r <interval>] [SAFE | STRONG | FORCE | NONDUR] [-t]
Cleanup -client [-m <qmgr>] -host <hostname> [-port <port>] [-channel <channel>] [-r <interval>] [SAFE | STRONG | FORCE | NONDUR] [-t]
The parameters of the command are as follows:
This is a dangerous mode that can leave an inconsistent state between the queue manager and the broker. You cannot run the cleanup utility in this mode while any WebSphere MQ JMS publish/subscribe applications are connected to the queue manager. If you try to do so, the cleanup utility ends.
You can use a programming interface to invoke the cleanup utility that is used with a broker based subscription store. Instances of the class com.ibm.mq.jms.Cleanup have getter and setter methods for each of the properties that are used to connect to a queue manager, and also for the cleanup level and cleanup interval. It exposes two additional methods:
This class allows complete customization of the publish/subscribe cleanup utility, but it is intended for use by system administration programs rather than application programs.
For more details, see Cleanup.
Notices |
Downloads |
Library |
Support |
Feedback
![]() ![]() |
jms11psc |