Remove a cluster queue from a queue manager


Scenario

  • The INVENTORY cluster has been set up as described in Adding a new queue manager that hosts a queue. It contains four queue managers. LONDON and AMSTERDAM both hold full repositories. PARIS and PARIS hold partial repositories. The inventory application runs on the systems in Amsterdam and Paris and is driven by the arrival of messages on the RCVINVCQ queue.

  • Because of reduced workload, you no longer want to run the inventory application in Paris. You want to disable the RCVINVCQ queue hosted by the queue manager PARIS, and have PARIS feed messages to the RCVINVCQ queue in AMSTERDAM.

  • Network connectivity exists between all four systems.

  • The network protocol is TCP.

 

1. Indicate that the queue is no longer available

To remove a queue from a cluster, remove the cluster name from the local queue definition. Do this from queue manager PARIS, using the ALTER QLOCAL command and specifying a blank cluster name, like this:

ALTER QLOCAL(RCVINVCQ) CLUSTER(' ')

 

2. Disable the queue

Disable the RCVINVCQ queue at PARIS so that no further messages can be written to it:

ALTER QLOCAL(RCVINVCQ) PUT(DISABLED)

Now messages in transit to this queue using MQOO_BIND_ON_OPEN will go to the dead-letter queue. You need to stop all applications from putting messages explicitly to the queue on this queue manager.

 

3. Monitor the queue until it is empty

Monitor the queue using the DISPLAY QUEUE command and specifying the attributes IPPROCS, OPPROCS, and CURDEPTH, or use the WRKMQMQSTS command on iSeries. When the number of input processes, the number of output processes, and the current depth of the queue are all zero, you can be sure that the queue is empty.

 

4. Monitor the channel to ensure there are no in-doubt messages

To be sure that there are no in-doubt messages on the channel TO.PARIS, monitor the cluster-sender channel called TO.PARIS on each of the other queue managers. To do this, issue the DISPLAY CHSTATUS command specifying the INDOUBT parameter from each queue manager:

DISPLAY CHSTATUS(TO.PARIS) INDOUBT

If there are any in-doubt messages, resolve them before proceeding. For example, you might try issuing the RESOLVE channel command or stopping and restarting the channel.

 

5. Delete the local queue

When you are satisfied that there are no more messages to be delivered to the inventory application at PARIS, you can delete the queue:

DELETE QLOCAL(RCVINVCQ)

 

The cluster achieved by task 4

The cluster set up by this task is similar to that set up by the previous task, except that the RCVINVCQ queue is no longer available at queue manager PARIS.

When you take the queue out of service (step 1), the PARIS queue manager sends a message to the two full repository queue managers notifying them of the change in status. The full repository queue managers pass on this information to other queue managers in the cluster that have requested updates to information concerning the RCVINVCQ.

Now when a queue manager wants to put a message to the RCVINVCQ, it sees, from its updated partial repository, that the RCVINVCQ is available only at AMSTERDAM, and so sends its message there.

You can now remove the inventory application from the system in Paris, to avoid duplication and save space on the system.

 

Extensions to this task

In this task description there is only one queue to remove and only one cluster to remove it from.

Suppose that there were many queues referring to a namelist containing many cluster names. For example, the PARIS queue manager might host not only the RCVINVCQ, but also the PAYROLLQ, SALESQ, and PURCHASESQ. PARIS makes these queues available in all the appropriate clusters, INVENTORY, PAYROLL, SALES, and PURCHASES. To do this, PARIS defines a namelist of the cluster names:

DEFINE NAMELIST(TOROLIST)
       DESCR('List of clusters PARIS is in')
       NAMES(INVENTORY, PAYROLL, SALES, PURCHASES)

and specifies this namelist on each queue definition, like this:

DEFINE QLOCAL(RCVINVCQ) CLUSNL(TOROLIST)
DEFINE QLOCAL(PAYROLLQ) CLUSNL(TOROLIST)
DEFINE QLOCAL(SALESQ) CLUSNL(TOROLIST)
DEFINE QLOCAL(PURCHASESQ) CLUSNL(TOROLIST)

Now suppose that you want to remove all those queues from the SALES cluster, because the SALES operation is to be taken over by the PURCHASES operation. All you need to do is alter the TOROLIST namelist to remove the name of the SALES cluster from it.

If you want to remove a single queue from one of the clusters in the namelist, create a new namelist, containing the remaining list of cluster names, and then alter the queue definition to use the new namelist. To remove the PAYROLLQ from the INVENTORY cluster:

  1. Create a new namelist:
    DEFINE NAMELIST(TOROSHORTLIST)
           DESCR('List of clusters PARIS is in other than INVENTORY')
           NAMES(PAYROLL, SALES, PURCHASES)

  2. Alter the PAYROLLQ queue definition:
    ALTER QLOCAL(PAYROLLQ) CLUSNL(TOROSHORTLIST)