Removing WebSphere Application Server durable subscriptions

When you use the IBM® MQ messaging provider with WebSphere® Application Server 7.0 and IBM MQ 8.0, durable subscriptions created by message-driven bean applications bound to activation specifications are not removed. Durable subscriptions can be removed using either the IBM MQ Explorer or an IBM MQ command line utility.

About this task

A message-driven bean application that removes a durable subscription can be configured to use either a listener port or an activation specification, provided that the application is running inside a WebSphere Application Server 7.0 or IBM MQ 8.0 instance that uses IBM MQ messaging provider normal mode to connect to IBM MQ.

If the message-driven bean application is bound to a listener port, then the IBM MQ messaging provider creates the durable subscription for the application the first time the application is started. The durable subscription is removed when the message-driven bean application is uninstalled from an application server, and the application server restarted.

A message-driven bean application that is bound to an activation specification works in a slightly different way. The durable subscription is created for the application the first time the application is started. However, the durable subscription is not removed when the application is uninstalled and the application server restarted.

This can lead to a number of durable subscriptions remaining on an IBM MQ Publish/Subscribe engine for applications that are no longer installed in a WebSphere Application Server system. These subscriptions are known as "orphan subscriptions", and can lead to issues on the queue manager when the Publish/Subscribe engine is running.

When a message is published on a topic, the IBM MQ Publish/Subscribe engine makes a copy of that message for each durable subscription that is registered on that topic, and put it on an internal queue. The applications using that durable subscription will then pick up and consume the message from this internal queue.

If the message-driven bean application that was using that durable subscription is no longer installed, the copies of the published messages for the application will continue to be made. However, these messages will never be processed, which means that there could be a large number of messages remaining on the internal queue that will never be removed.

Before you begin

Subscriptions that are registered with the IBM MQ Publish/Subscribe engine will have a Subscription Name associated with them.

Durable subscriptions created by the WebSphere Application Server IBM MQ messaging provider for message-driven beans that are bound to activation specifications will have a Subscription Name in the following format:

JMS:queue manager name:client identifier:subscription name
Where:
queue manager name
This is the name of the IBM MQ queue manager where the Publish/Subscribe engine is running.
client identifier
This is the value of the Client ID property of the activation specification to which the message-driven bean is bound.
subscription name
This is the value of the activation specification property Subscription name for the activation specification that the message-driven bean application has been configured to use.
For example, suppose that we have an activation specification that has been set up to connect to the queue manager testQM. The activation specification has the following properties set:
  • Client ID = testClientID
  • Subscription name = durableSubscription1
If a message-driven bean that takes out a durable subscription is bound to this activation specification, a subscription is created on the IBM MQ publish/subscribe engine on the queue manager testQM that has the following Subscription name:
  • JMS:testQM:testClientID:durableSubscription1
The subscriptions that have been registered with the IBM MQ publish/subscribe engine for a given queue manager can be viewed in one of the two following ways:
  • The first option is to use the MQ Explorer. When the MQ Explorer has been connected to a queue manager that is being used for publish/subscribe work, the list of subscribers that are currently registered with the publish/subscribe engine can be viewed by clicking on the IBM WebSphere MQ ->queue manager name-> Subscriptions entry in the navigation pane.
  • The other way to view the subscriptions that have been registered with a publish/subscribe engine is to use the IBM MQ command line utility runmqsc and run the command display sub. To do this, bring up a command prompt, change to the WebSphere MQ\bin directory, and enter the following command to start runmqsc:
    • runmqsc queue manager name
    When the runmqsc utility has started, enter the following command to list all of the durable subscriptions currently registered with the publish/subscribe engine running on the queue manager to which runmqsc has connected:
    • display sub(*) durable
To check if the durable subscriptions registered with the publish/subscribe engines are still active:
  1. Generate the list of durable subscriptions that have been registered with the Publish/Subscribe engine.
  2. For each durable subscription:
    • Look at the subscription name for the durable subscriber, and note the client identifier and subscription name value.
    • Look at the WebSphere Application Server systems that are connecting to this Publish/Subscribe engine. See if there are any activation specifications defined that have the Client ID property that matches the client identifier value and the subscription name property that matches the subscription name.
    • If no activation specifications are found that have the Client ID and subscription name properties that match the client identifier and subscription name fields in the IBM MQ subscription name, then there are no activation specifications using this durable subscription. The durable subscription can be deleted.
    • If there is an activation specification defined that matches the durable subscription name, then the final check that needs to be made is to see if there is a message-driven bean application using this activation specification. To do this:
      • Make a note of the JNDI name for the activation specification that has taken out the durable subscription at which you are currently looking.
      • Bring up the Configuration pane in the WebSphere Application Server administrative console for each message-driven bean application that has been installed.
      • Click the Message Driven Bean listener bindings link in the Configuration pane.
      • A table with information about the message-driven bean application is displayed. If the activation specification radio button is selected in the Bindings column, and the Target Resource JNDI name field contains the JNDI name for the activation specification that has taken out the durable subscription, then the subscription is still in use and cannot be deleted.
      • If no message-driven bean applications can be found that are using the activation specification, then the durable subscription can be deleted.

Procedure

Once an "orphaned" durable subscription has been identified, it can be deleted using either the IBM MQ Explorer or the IBM MQ command line utility runmqsc.

To delete an "orphaned" durable subscription using the IBM MQ Explorer:
  1. Highlight the entry for the subscription
  2. Right click the entry, and select Delete... from the menu. A confirmation window appears.
  3. Check the subscription name displayed in the confirmation window is correct, and click Yes.
The IBM MQ Explorer now deletes the subscription from the Publish/Subscribe engine, and cleans up any internal resources associated with it (such as unprocessed messages that were published for the topic on which the durable subscription was registered).
To delete an "orphaned" durable subscription using the IBM MQ command line utility runmqsc, the command delete sub must be run:
  1. Open a command prompt session
  2. Navigate to the IBM MQ\bin directory
  3. Enter the following command to start runmqsc:
    
    runmqsc queue manager name 
  4. When the runmqsc utility has started, enter:
    
    delete sub(Subscription name)
    where Subscription name is the subscription name of the durable subscription, which takes the form:
    • JMS:queue manager name:client identifier:subscription name