This topic has not yet been rated - Rate this topic

SubscriptionClient Class

The anchor class used in run-time operations related to a topic subscription.

System.Object
  Microsoft.ServiceBus.Messaging.MessageClientEntity
    Microsoft.ServiceBus.Messaging.SubscriptionClient

Namespace:  Microsoft.ServiceBus.Messaging
Assembly:  Microsoft.ServiceBus (in Microsoft.ServiceBus.dll)
public abstract class SubscriptionClient : MessageClientEntity

The SubscriptionClient type exposes the following members.

  Name Description
Protected property InternalReceiver Gets or sets the message receiver for the subscription.
Public property IsClosed Gets or sets a value that indicates whether the message client entity is closed. (Inherited from MessageClientEntity.)
Protected property IsSubQueue Gets or sets a value that indicates whether the message receiver is created from a subqueue.
Public property MessagingFactory Gets the messaging factory used to create this subscription client.
Public property Mode Gets the message receive mode when processing the received message.
Public property Name Gets the name of the subscription.
Public property PrefetchCount Gets or sets the number of messages that the message receiver can simultaneously request.
Public property TopicPath Gets the full pathname of the topic.
Top
  Name Description
Public method Abandon Discards the message and relinquishes the message lock ownership.
Public method Abort Aborts the message client entity and puts its status into a closing state. (Inherited from MessageClientEntity.)
Public method AcceptMessageSession() Accepts a message session that allows grouping of related messages for processing in a single transaction.
Public method AcceptMessageSession(String) Accepts a message session that allows grouping of related messages for processing in a single transaction using the given session identifier.
Public method AcceptMessageSession(TimeSpan) Accepts a message session that allows grouping of related messages for processing in a single transaction using the specified server wait time.
Public method AcceptMessageSession(String, TimeSpan) Accepts a message session that allows grouping of related messages for processing in a single transaction using the given session identifier and wait time.
Public method AddRule(RuleDescription) Adds a new rule to the Subscription using the specified rule description.
Public method AddRule(String, Filter) Adds a rule to the current subscription with the specified name and filter expression.
Public method BeginAbandon Begins an asynchronous operation to abandon the message and relinquish its lock.
Public method BeginAcceptMessageSession(AsyncCallback, Object) Begin an asynchronous operation to accept a message session.
Public method BeginAcceptMessageSession(String, AsyncCallback, Object) Begin an asynchronous operation to accept a message session.
Public method BeginAcceptMessageSession(TimeSpan, AsyncCallback, Object) Begin an asynchronous operation to accept a message session.
Public method BeginAcceptMessageSession(String, TimeSpan, AsyncCallback, Object) Begin an asynchronous operation to accept a message session.
Public method BeginAddRule(RuleDescription, AsyncCallback, Object) Begins an asynchronous operation to add a new rule to the subscription.
Public method BeginAddRule(String, Filter, AsyncCallback, Object) Begins an asynchronous operation to add a new rule to the subscription.
Public method BeginClose Begins an asynchronous operation to close the message client entity. (Inherited from MessageClientEntity.)
Public method BeginComplete Begins an asynchronous operation to complete processing of a message.
Public method BeginDeadLetter(Guid, AsyncCallback, Object) Begins an asynchronous operation to move a message to the dead letter queue.
Public method BeginDeadLetter(Guid, String, String, AsyncCallback, Object) Begins an asynchronous operation to move a message to the dead letter queue.
Public method BeginDefer Begins an asynchronous operation to suspend processing of a message.
Public method BeginReceive(AsyncCallback, Object) Begins an asynchronous operation to receive a message.
Public method BeginReceive(Int64, AsyncCallback, Object) Begins an asynchronous operation to receive a message.
Public method BeginReceive(TimeSpan, AsyncCallback, Object) Begins an asynchronous operation to receive a message.
Public method BeginRemoveRule Begins an asynchronous remove rule action.
Public method Close Closes the message client entity and puts its status into a closed state. (Inherited from MessageClientEntity.)
Public method Complete Completes processing of a message.
Public method DeadLetter(Guid) Moves the undelivered message to the dead letter queue.
Public method DeadLetter(Guid, String, String) Moves the undelivered message to the dead letter queue.
Public method Defer Suspends the processing of a message.
Public method EndAbandon Finishes an asynchronous operation to abandon the message and relinquish its lock.
Public method EndAcceptMessageSession Finishes an asynchronous operation to accept a message session that allows grouping of related messages for processing in a single transaction.
Public method EndAddRule Ends an asynchronous add rule operation.
Public method EndClose Finishes an asynchronous operation to close the message client entity. (Inherited from MessageClientEntity.)
Public method EndComplete Finishes an asynchronous operation to complete processing of a message.
Public method EndDeadLetter Finishes an asynchronous operation to move message to the dead letter queue.
Public method EndDefer Finishes an asynchronous operation to suspend processing of a message.
Public method EndReceive Finishes an asynchronous operation to receive a message.
Public method EndRemoveRule Ends an asynchronous remove rule operation.
Public method Equals (Inherited from Object.)
Protected method Fault Puts the message client entity into a faulted state. (Inherited from MessageClientEntity.)
Protected method Finalize (Inherited from Object.)
Public method Static member FormatDeadLetterPath Builds a format name deadletter path using the specified topic path and subscription name.
Public method Static member FormatSubscriptionPath Builds a format name subscription path using the specified topic path and subscription name.
Public method GetHashCode (Inherited from Object.)
Public method GetType (Inherited from Object.)
Protected method MemberwiseClone (Inherited from Object.)
Protected method OnAbort Executes the abort action. (Overrides MessageClientEntity.OnAbort().)
Protected method OnBeginAcceptMessageSession Executes upon calling the BeginAcceptMessageSession operation.
Protected method OnBeginAddRule Executes upon calling the BeginAddRule operation.
Protected method OnBeginClose Executes the begin close action. (Overrides MessageClientEntity.OnBeginClose(TimeSpan, AsyncCallback, Object).)
Protected method OnBeginCreateReceiver(ReceiveMode, TimeSpan, AsyncCallback, Object) Executes the begin create receiver action.
Protected method OnBeginCreateReceiver(String, String, ReceiveMode, TimeSpan, AsyncCallback, Object) Executes the begin create receiver action.
Protected method OnBeginOpen Executes upon calling the operation to begin to open the message client entity. (Inherited from MessageClientEntity.)
Protected method OnBeginRemoveRule Begins removing a Rule from a Subscription through the run-time client protocol.
Protected method OnClose Executes the close action. (Overrides MessageClientEntity.OnClose(TimeSpan).)
Protected method OnClosed Occurs when the message client entity is transitioned into a closing state. (Inherited from MessageClientEntity.)
Protected method OnEndAcceptMessageSession Executes upon calling the EndAcceptMessageSession operation.
Protected method OnEndAddRule Ends the asynchronous call to OnBeginAddRule(String, RuleDescription, TimeSpan, AsyncCallback, Object).
Protected method OnEndClose Executes the end close action. (Overrides MessageClientEntity.OnEndClose(IAsyncResult).)
Protected method OnEndCreateReceiver Executes the end create receiver action.
Protected method OnEndOpen Executes upon calling the operation to end to open the message client entity. (Inherited from MessageClientEntity.)
Protected method OnEndRemoveRule Ends the asynchronous call to OnBeginRemoveRule(String, TimeSpan, AsyncCallback, Object).
Protected method OnFaulted Executes upon calling the Fault operation. (Inherited from MessageClientEntity.)
Protected method OnOpen Executes upon calling the operation to open the message client entity. (Inherited from MessageClientEntity.)
Protected method OnOpened Executes when the message client entity is opened. (Inherited from MessageClientEntity.)
Public method Receive() Receives a message using the InternalReceiver.
Public method Receive(Int64) Receives a message using the InternalReceiver.
Public method Receive(TimeSpan) Receives a message using the InternalReceiver.
Public method RemoveRule Removes the rule described by ruleName.
Protected method ThrowIfClosed Throws an exception if the message client entity is closed. (Inherited from MessageClientEntity.)
Protected method ThrowIfDisposed Throws an exception if the message client entity is disposed. (Inherited from MessageClientEntity.)
Protected method ThrowIfDisposedOrImmutable Throws an exception if the client is disposed or immutable. (Inherited from MessageClientEntity.)
Protected method ThrowIfDisposedOrNotOpen Throws an exception if the client is disposed or not open. (Inherited from MessageClientEntity.)
Protected method ThrowIfFaulted Throws an exception if the client is faulted. (Inherited from MessageClientEntity.)
Public method ToString (Inherited from Object.)
Top

This abstract class is not meant to be inherited, so protected members of this class should be ignored.

// Create subscription client
SubscriptionClient mySubscriptionClient = 
factory.CreateSubscriptionClient(topicName, subscriptionName);

// Create a receiver
MessageReceiver myMessageReceiver = mySubscriptionClient.CreateReceiver(ReceiveMode.PeekLock);

// Receive messages
for (int count = 0; count < MsgCount; count++)
{
    var message = subscriptionClient.Receive();
    message.Complete();
}

Any public static (Shared in Visual Basic) members of this type are thread safe. Instance members are also guaranteed to be thread safe.

Did you find this helpful?
(1500 characters remaining)