com.ibm.mq.jms

Class Cleanup

  • java.lang.Object
    • com.ibm.msg.client.jms.internal.JmsReadablePropertyContextImpl
      • com.ibm.msg.client.jms.internal.JmsPropertyContextImpl
        • com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl
  • All Implemented Interfaces:
    JmsConnectionFactory, JmsPropertyContext, JmsReadablePropertyContext, com.ibm.msg.client.provider.ProviderPropertyContextCallback, java.io.Serializable, java.lang.Runnable, java.util.Map<java.lang.String,java.lang.Object>, javax.jms.ConnectionFactory, javax.naming.Referenceable


    public class Cleanup
    extends MQConnectionFactory
    implements java.lang.Runnable
    Cleanup contains utilities for dealing with non-durable subscriptions which are broken, by using the SUBSTATE(BROKER) option. The class is not applicable if you use a real-time connection to a broker.
    See Also:
    Serialized Form
    • Constructor Detail

      • Cleanup

        public Cleanup()
        Default constructor.
      • Cleanup

        public Cleanup(MQConnectionFactory mqcf)
                throws javax.jms.JMSException
        Constructor that imports property values.
        Parameters:
        mqcf - the topic connection factory that provides the values.
        Throws:
        javax.jms.JMSException
    • Method Detail

      • setCleanupInterval

        public void setCleanupInterval(long interval)
                                throws javax.jms.JMSException
        Sets the cleanup interval.
        Overrides:
        setCleanupInterval in class MQConnectionFactory
        Parameters:
        interval - the cleanup interval in milliseconds.
        Throws:
        javax.jms.JMSException - if interval is either null or invalid.
      • main

        public static void main(java.lang.String[] args)
                         throws java.io.UnsupportedEncodingException
        Invokes the utility directly from a command line. You can use this if you use the broker-based subscription store. Syntax for bindings attach:

        Cleanup [-m ] [-r ] [SAFE | STRONG | FORCE | NONDUR] [-t]
        Syntax for client attach:

        Cleanup -client [-m ] -host [-port ] [-channel ] [-r ] [SAFE | STRONG | FORCE | NONDUR] [-t]

        qmgr
        the name of the queue manager.
        hostname
        the name of the host which is running the queue manager.
        port
        the port on which the queue manager is listening.
        channel
        the name of the channel.
        interval
        the interval between executions of cleanup, in minutes. If not set, cleanup is performed once. This option is not valid with cleanup types of FORCE or NONDUR.
        -t
        enables tracing.
        SAFE | STRONG | FORCE | NONDUR
        sets type of clean up. See setCleanupLevel.
        Parameters:
        args - the input arguments
        Throws:
        java.io.UnsupportedEncodingException
      • stop

        public void stop()
        Stops any running cleanup thread. Returns when run() has finished. Does nothing if run() is not running.
      • setExceptionListener

        public void setExceptionListener(javax.jms.ExceptionListener el)
        Sets the ExceptionListener. If set, the ExceptionListener receives any exceptions caused while run() is running. Cleanup terminates shortly after issuing the exception to the ExceptionListener. To remove an ExceptionListener, call this method passing in a null value
        Parameters:
        el - the exception listener.
      • getExceptionListener

        public javax.jms.ExceptionListener getExceptionListener()
        Gets the ExceptionListener.
        Returns:
        the exception listener.
      • setPrintWriter

        public void setPrintWriter(java.io.PrintWriter pw)
        Sets the Print Writer. If set, the PrintWriter will log informational messages to the console when repeated cleanup is running at regular intervals. To remove a PrintWriter, call this method passing in a null value.
        Parameters:
        pw - the PrintWriter.
      • isRunning

        public boolean isRunning()
        Indicates whether run() is currently active.
        Returns:
        true if active; false otherwise.
      • cleanup

        public void cleanup(boolean runAtRegularIntervals)
                     throws javax.jms.JMSException
        Perform cleanup of unwanted messages for non-durable subscribers who are no longer active. This method will either perform a single cleanup operation, or a number of repeating cleanup operations at regular intervals. To perform cleanup operations at regular invervals, call this method passing in the value true.
        Parameters:
        runAtRegularIntervals - - whether repeating cleanup operations should be run at regular intervals.
        Throws:
        javax.jms.JMSException - if the operation fails
(c) Copyright IBM Corp. 2008, 2015. All Rights Reserved.