Assembly: TIBCO.EMS (in TIBCO.EMS.dll)
Syntax
public MessageConsumer CreateSharedDurableConsumer( Topic topic, string name, string messageSelector ) |
Public Function CreateSharedDurableConsumer ( _ topic As Topic, _ name As String, _ messageSelector As String _ ) As MessageConsumer |
public: MessageConsumer^ CreateSharedDurableConsumer( Topic^ topic, String^ name, String^ messageSelector ) |
Parameters
- topic
- Type: TIBCO.EMS..::.Topic
the Topic to subscribe to
- name
- Type: System..::.String
the name used to identify this subscription
- messageSelector
- Type: System..::.String
only messages with properties matching the message selector expression are added to the durable subscription. A value of null or an empty string indicates that there is no message selector for the durable subscription.
Remarks
A durable subscription is used by an application which needs to receive all the messages published on a topic, including the ones published when there is no active consumer associated with it. The EMS Server retains a record of this durable subscription and ensures that all messages from the topic's publishers are retained until they are delivered to, and acknowledged by, a consumer on this durable subscription or until they have expired.
A durable subscription will continue to accumulate messages until it is deleted using the Unsubscribe(String) method.
This method may only be used with shared durable subscriptions. Any durable subscription created using this method will be shared. This means that multiple active (i.e. not closed) consumers on the subscription may exist at the same time. The term "consumer" here means a MessageConsumer object in any client.
A shared durable subscription is identified by a name specified by the client and by the client identifier (which may be unset). An application which subsequently wishes to create a consumer on that shared durable subscription must use the same client identifier.
If a shared durable subscription already exists with the same name and client identifier (if set), and the same topic and message selector has been specified, then this method creates a MessageConsumer on the existing shared durable subscription.
If a shared durable subscription already exists with the same name and client identifier (if set) but a different topic or message selector has been specified, and there is no consumer already active (i.e. not closed) on the durable subscription then this is equivalent to unsubscribing (deleting) the old one and creating a new one.
If a shared durable subscription already exists with the same name and client identifier (if set) but a different topic or message selector has been specified, and there is a consumer already active (i.e. not closed) on the durable subscription, then an EMSException will be thrown.
A shared durable subscription and an unshared durable subscription may not have the same name and client identifier (if set). If an unshared durable subscription already exists with the same name and client identifier (if set) then an EMSException is thrown.
There is no restriction on durable subscriptions and shared non-durable subscriptions having the same name and clientId (which may be unset). Such subscriptions would be completely separate.