Deleting Durable Subscriptions Modifying Durable Subscriptions

Managing Your Applications 6-21 Do some IO stuff; } finally { if con = null con.close; } For more information about the JMS Automatic Reconnect feature, see Section 14.1, Automatic JMS Client Failover.

6.7.7 Deleting Durable Subscriptions

To delete a durable subscription, you use the following TopicSession method: public void unsubscribe String name throws JMSException You must specify the name of the durable subscription to be deleted. You cannot delete a durable subscription if any of the following are true: ■ A TopicSubscriber is still active on the session. ■ A message received by the durable subscription is part of a transaction or has not yet been acknowledged in the session.

6.7.8 Modifying Durable Subscriptions

To modify a durable subscription, perform the following steps: 1. Optionally, delete the durable subscription, as described in Section 6.7.7, Deleting Durable Subscriptions. This step is optional. If not explicitly performed, the deletion will be executed implicitly when the durable subscription is recreated in the next step. 2. Use the methods described in Section 6.7.5, Creating Subscribers for a Durable Subscription to recreate a durable subscription of the same name, but specifying a different topic name, message selector, or noLocal value. The durable subscription is recreated based on the new values. Note: You can also delete durable subscriptions from the Administration Console. For information on managing durable subscriptions, see Section 6.7.9, Managing Durable Subscriptions. Note: When recreating a durable subscription, be careful to avoid creating a durable subscription with a duplicate name. For example, if you attempt to delete a durable subscription from a JMS server that is unavailable, the delete call fails. If you subsequently create a durable subscription with the same name on a different JMS server, you may experience unexpected results when the first JMS server becomes available. Because the original durable subscription has not been deleted, when the first JMS server again becomes available, there will be two durable subscriptions with duplicate names. 6-22 Programming JMS for Oracle WebLogic Server

6.7.9 Managing Durable Subscriptions