WebLogic Messaging API Class Library

ISession.CreateDurableSubscriber\xA0Method\xA0(ITopic, String, String, Boolean)

Creates a durable subscriber to the specified topic, using a message selector and specifying whether messages published by its own connection should be delivered to it.

If a client needs to receive all the messages published on a topic, including the ones published while the subscriber is inactive, it uses a durable IMessageConsumer. The JMS server retains a record of this durable subscription and insures that all messages from the topic's publishers are retained until they are acknowledged by this durable subscriber or they have expired.

Sessions with durable subscribers must always provide the same client identifier. In addition, each client must specify a name which uniquely identifies (within client identifier) each durable subscription it creates. Only one session at a time can have a IMessageConsumer for a particular durable subscription. An inactive durable subscriber is one that exists but does not currently have a message consumer associated with it.

A client can change an existing durable subscription by creating a durable IMessageConsumer with the same name and a new topic and/or message selector. Changing a durable subscriber is equivalent to unsubscribing (deleting) the old one and creating a new one.



the non-temporary ITopic to subscribe to
the name used to identify this subscription
only messages with properties matching the message selector expression are delivered. A value of null or an empty string indicates that there is no message selector for the message consumer.
if set, inhibits the delivery of messages published by its own connection

Return Value

An IMessageConsumer for the specified destination


Warning: Delete unused durable subscriptions using ISession.Unsubscribe. Unused durable subscriptions continue to accumulate topic messages as new messages are produced to the topic, even when no consumer is attached to the durable subscription; this consumes resources on the JMS server and can eventually lead to resource issues such as quota exceptions, or even out-of-memory, because no consumer is ever removing messages from the durable subscription.


Exception TypeCondition
MessageExceptionif the session fails to create a subscriber due to some internal error.
InvalidDestinationExceptionif an invalid topic is specified.
InvalidSelectorExceptionif the message selector is invalid.

See Also

ISession Interface | WebLogic.Messaging Namespace | ISession. Overload List | Message selector syntax. | Deleting durable subscriptions.