Cleanup

public class Cleanup
extends MQConnectionFactory
implements Runnable
java.lang.Object
   |
   +----com.ibm.mq.jms.MQConnectionFactory
           |
           +----com.ibm.mq.jms.Cleanup
          

Cleanup contains utilities for dealing with nondurable subscriptions which are broken, by using the SUBSTATE(BROKER) option. The class is not applicable if you use a direct connection to a broker.

Constructors

Cleanup

public Cleanup();

Default constructor.

Cleanup

public Cleanup(MQConnectionFactory mqcf) throws JMSException;

Constructor that imports property values.

Parameters

Methods

cleanup

public void cleanup() throws JMSException;

Runs Cleanup once.

Exceptions

getCleanupInterval

public long getCleanupInterval();

Gets the cleanup interval.

Returns

getCleanupLevel

public int getCleanupLevel();

Gets the cleanup level.

Returns

getExceptionListener

public ExceptionListener getExceptionListener();

Gets the ExceptionListener.

Returns

isRunning

public boolean isRunning();

Indicates whether run() is currently active.

Returns

main

public static void main(String[] args) 
              throws 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.
-t
enables tracing, to the mqjms.trc file.
SAFE | STRONG | FORCE | NONDUR
sets type of clean up. See setCleanupLevel().

run

public void run();

Runs Cleanup. It runs in the background at intervals, as determined by setCleanupLevel() and setCleanupInterval(). If the field set by setCleanupInterval() is zero, Cleanup runs once and returns. Otherwise Cleanup runs regularly at the time in milliseconds set by setCleanupInterval(). CleanupInterval must be zero with JMSC.MQJMS_CLEANUP_FORCE or JMSC.MQJMS_CLEANUP_NONDUR set, and CleanupLevel cannot be MQJMS_CLEANUP_NONE. In these cases the method fails with an IllegalStateException. Any exceptions generated are routed to the ExceptionListener.

setCleanupInterval

public void setCleanupInterval(long interval) throws JMSException;

Sets the cleanup interval.

Parameters
Exceptions

setCleanupLevel

public void setCleanupLevel(int level) throws JMSException;

Sets the cleanup level.

Parameters
Exceptions

setExceptionListener

public void setExceptionListener(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.

Parameters

setPassword

public void setPassword(String newPassword);

Sets the durable connection password

Parameters

setUserID

public void setUserID(String newuserID);

Sets the durable connection user ID.

Parameters

stop

public void stop();

Stops any running cleanup thread. Returns when run() has finished. Does nothing if run() is not running.