Class SubscriptionClient
- Namespace
- Microsoft.ServiceBus.Messaging
- Assembly
- Microsoft.ServiceBus.dll
Represents the anchor class used in run-time operations related to a topic subscription.
public abstract class SubscriptionClient : ClientEntity
- Inheritance
-
SubscriptionClient
- Inherited Members
Properties
MessagingFactory
Gets the messaging factory used to create this subscription client.
public MessagingFactory MessagingFactory { get; }
Property Value
- MessagingFactory
The messaging factory used to create this subscription client.
Mode
Gets the message receive mode when processing the received message.
public ReceiveMode Mode { get; }
Property Value
- ReceiveMode
The message ReceiveMode when processing the received message.
Name
Gets the name of the subscription.
public string Name { get; }
Property Value
- string
The name of the subscription.
PrefetchCount
Gets or sets the number of messages that the message receiver can simultaneously request.
public int PrefetchCount { get; set; }
Property Value
- int
The number of messages that the message receiver can simultaneously request.
TopicPath
Gets the full pathname of the topic.
public string TopicPath { get; }
Property Value
- string
The full pathname of the topic.
Methods
Abandon(Guid)
Discards the message and relinquishes the message lock ownership.
public void Abandon(Guid lockToken)
Parameters
lockToken
GuidThe lock token bound to the locked message instance to abandon.
Exceptions
- TimeoutException
Thrown if the operation exceeded the timeout value set via OperationTimeout.
- OperationCanceledException
Thrown if the client entity has been closed or aborted.
Abandon(Guid, IDictionary<string, object>)
Discards the message and relinquishes the message lock ownership.
public void Abandon(Guid lockToken, IDictionary<string, object> propertiesToModify)
Parameters
lockToken
GuidThe lock token bound to the locked message instance to abandon.
propertiesToModify
IDictionary<string, object>A collection of property objects to be modified.
AbandonAsync(Guid)
Asynchronously discards the message and relinquishes the message lock ownership.
public Task AbandonAsync(Guid lockToken)
Parameters
lockToken
GuidThe lock token bound to the locked message instance to abandon.
Returns
- Task
A task instance that represents the asynchronous abandon operation.
AbandonAsync(Guid, IDictionary<string, object>)
Asynchronously discards the message and relinquishes the message lock ownership.
public Task AbandonAsync(Guid lockToken, IDictionary<string, object> propertiesToModify)
Parameters
lockToken
GuidThe lock token bound to the locked message instance to abandon.
propertiesToModify
IDictionary<string, object>A collection of property objects to be modified.
Returns
- Task
A task instance that represents the asynchronous abandon operation.
AcceptMessageSession()
Accepts a message session that allows grouping of related messages for processing in a single transaction.
public MessageSession AcceptMessageSession()
Returns
- MessageSession
A MessageSession that allows grouping of related messages for processing in a single transaction.
AcceptMessageSession(string)
Accepts a message session that allows grouping of related messages for processing in a single transaction using the given session identifier.
public MessageSession AcceptMessageSession(string sessionId)
Parameters
sessionId
stringThe session identifier of the message session.
Returns
- MessageSession
A MessageSession that allows grouping of related messages for processing in a single transaction.
Exceptions
- ArgumentException
Thrown if sessionId is null, empty, or white spaces.
- TimeoutException
Thrown if the operation exceeded the timeout value set by OperationTimeout.
- OperationCanceledException
Thrown if the client is already closed, aborted, or disposed.
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 MessageSession AcceptMessageSession(string sessionId, TimeSpan serverWaitTime)
Parameters
sessionId
stringThe session identifier of the message session.
serverWaitTime
TimeSpanThe time span the server waits for processing messages before it times out.
Returns
- MessageSession
A MessageSession that allows grouping of related messages for processing in a single transaction.
Exceptions
- ArgumentException
Thrown if sessionId is null, empty, or white spaces.
- ArgumentOutOfRangeException
Thrown if serverWaitTime is not a positive TimeSpan value.
- TimeoutException
Thrown if the operation exceeded the timeout value set by
. - OperationCanceledException
Thrown if the client is already closed, aborted, or disposed.
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 MessageSession AcceptMessageSession(TimeSpan serverWaitTime)
Parameters
serverWaitTime
TimeSpanThe time span the server waits for processing messages before it times out.
Returns
- MessageSession
A MessageSession that allows grouping of related messages for processing in a single transaction.
Exceptions
- ArgumentOutOfRangeException
Thrown if serverWaitTime is not a positive TimeSpan value.
- TimeoutException
Thrown if the operation exceeded the timeout value set by
. - OperationCanceledException
Thrown if the client is already closed, aborted, or disposed.
AcceptMessageSessionAsync()
Asynchronously accepts a message session that allows grouping of related messages for processing in a single transaction using the specified server wait time.
public Task<MessageSession> AcceptMessageSessionAsync()
Returns
- Task<MessageSession>
A task instance that represents the asynchronous accept message session operation.
AcceptMessageSessionAsync(string)
Asynchronously accepts a message session that allows grouping of related messages for processing in a single transaction using the specified server wait time.
public Task<MessageSession> AcceptMessageSessionAsync(string sessionId)
Parameters
sessionId
stringThe session identifier of the message session.
Returns
- Task<MessageSession>
A task instance that represents the asynchronous accept message session operation.
AcceptMessageSessionAsync(string, TimeSpan)
Asynchronously accepts a message session that allows grouping of related messages for processing in a single transaction using the specified server wait time.
public Task<MessageSession> AcceptMessageSessionAsync(string sessionId, TimeSpan serverWaitTime)
Parameters
sessionId
stringThe session identifier of the message session.
serverWaitTime
TimeSpanThe time span the server waits for processing messages before it times out.
Returns
- Task<MessageSession>
A task instance that represents the asynchronous accept message session operation.
AcceptMessageSessionAsync(TimeSpan)
Asynchronously accepts a message session that allows grouping of related messages for processing in a single transaction using the specified server wait time.
public Task<MessageSession> AcceptMessageSessionAsync(TimeSpan serverWaitTime)
Parameters
serverWaitTime
TimeSpanThe time span the server waits for processing messages before it times out.
Returns
- Task<MessageSession>
A task instance that represents the asynchronous accept message session operation.
AddRule(RuleDescription)
Adds a new rule to the Microsoft.ServiceBus.Messaging.Subscription using the specified rule description.
public void AddRule(RuleDescription description)
Parameters
description
RuleDescriptionThe rule description that provides metadata of the rule to add.
Exceptions
- ArgumentNullException
Thrown if
description
is null.- ArgumentException
Thrown if
description.Name
is null, white space empty or not in the right format.- ArgumentOutOfRangeException
Thrown if
description.Name
length has exceeded the limit of 50 characters.- TimeoutException
Thrown if the operation exceeded the timeout value set by OperationTimeout.
- OperationCanceledException
Thrown if the client entity has been closed or aborted.
- MessagingEntityAlreadyExistsException
Thrown if the rule with the same name as
description.Name
already existed for this subscription.- MessagingEntityAlreadyExistsException
Thrown when an attempt is made to add another rule with same name as one that has already been added.
AddRule(string, Filter)
Adds a rule to the current subscription with the specified name and filter expression.
public void AddRule(string ruleName, Filter filter)
Parameters
ruleName
stringThe name of the rule to add.
filter
FilterThe filter expression against which messages will be matched.
Exceptions
- ArgumentNullException
Thrown if
filter
is null.- ArgumentException
Thrown if
ruleName
is null, white space empty or not in the right format.- ArgumentOutOfRangeException
Thrown if
ruleName
length has exceeded the limit of 50 characters.- TimeoutException
Thrown if the operation exceeded the timeout value set via OperationTimeout.
- OperationCanceledException
Thrown if the client entity has been closed or aborted.
- MessagingEntityAlreadyExistsException
Thrown if the rule with the same name as
ruleName
already existed for this subscription.- MessagingEntityAlreadyExistsException
Thrown when an attempt is made to add another rule with same name as one that has already been added.
AddRuleAsync(RuleDescription)
Asynchronously adds a new rule to the Microsoft.ServiceBus.Messaging.Subscription using the specified rule description.
public Task AddRuleAsync(RuleDescription description)
Parameters
description
RuleDescriptionThe rule description that provides metadata of the rule to add.
Returns
- Task
A task instance that represents the asynchronous add rule operation.
AddRuleAsync(string, Filter)
Asynchronously adds a rule to the current subscription with the specified name and filter expression.
public Task AddRuleAsync(string ruleName, Filter filter)
Parameters
ruleName
stringThe name of the rule to add.
filter
FilterThe filter expression against which messages will be matched.
Returns
- Task
A task instance that represents the asynchronous add rule operation.
Complete(Guid)
Completes processing of a message.
public void Complete(Guid lockToken)
Parameters
lockToken
GuidThe lock token bound to the locked message instance.
Exceptions
- TimeoutException
Thrown if the operation exceeded the timeout value set by OperationTimeout.
- OperationCanceledException
Thrown if the client entity has been closed or aborted.
- MessageLockLostException
Thrown if the message represented by
lockToken
has lost the message lock.
CompleteAsync(Guid)
Asynchronously completes processing of a message.
public Task CompleteAsync(Guid lockToken)
Parameters
lockToken
GuidThe lock token bound to the locked message instance.
Returns
- Task
A task instance that represents the asynchronous complete operation.
CompleteBatch(IEnumerable<Guid>)
Completes processing of a batch.
public void CompleteBatch(IEnumerable<Guid> lockTokens)
Parameters
lockTokens
IEnumerable<Guid>The lock tokens bound to the locked message instance.
CompleteBatchAsync(IEnumerable<Guid>)
Asynchronously completes processing of a batch.
public Task CompleteBatchAsync(IEnumerable<Guid> lockTokens)
Parameters
lockTokens
IEnumerable<Guid>The lock tokens bound to the locked message instance.
Returns
- Task
A task instance that represents the asynchronous complete batch operation.
Create(string, string)
Creates a new copy of SubscriptionClient with specified name and topic path.
public static SubscriptionClient Create(string topicPath, string name)
Parameters
Returns
- SubscriptionClient
A new copy of SubscriptionClient.
Create(string, string, ReceiveMode)
Creates a new copy of SubscriptionClient with specified name, topic path and mode.
public static SubscriptionClient Create(string topicPath, string name, ReceiveMode mode)
Parameters
topicPath
stringThe full pathname of the topic.
name
stringThe name of the subscription.
mode
ReceiveModeThe message receive mode.
Returns
- SubscriptionClient
A new copy of SubscriptionClient.
CreateFromConnectionString(string, string, string)
Creates a new copy of SubscriptionClient from a connection string with specified topic path and name.
public static SubscriptionClient CreateFromConnectionString(string connectionString, string topicPath, string name)
Parameters
connectionString
stringThe connection string.
topicPath
stringThe full pathname of the topic.
name
stringThe name of the subscription.
Returns
- SubscriptionClient
A new copy of SubscriptionClient.
CreateFromConnectionString(string, string, string, ReceiveMode)
Creates a new copy of SubscriptionClient from a connection string with specified topic path, name and mode.
public static SubscriptionClient CreateFromConnectionString(string connectionString, string topicPath, string name, ReceiveMode mode)
Parameters
connectionString
stringThe connection string.
topicPath
stringThe full pathname of the topic.
name
stringThe name of the subscription.
mode
ReceiveModeThe message receive mode.
Returns
- SubscriptionClient
A new copy of SubscriptionClient.
DeadLetter(Guid)
Moves the undelivered message to the dead letter queue.
public void DeadLetter(Guid lockToken)
Parameters
lockToken
GuidThe lock token bound to the locked message instance.
Exceptions
- TimeoutException
Thrown if the operation exceeded the timeout value set by OperationTimeout.
- OperationCanceledException
Thrown if the client entity has been closed or aborted.
- MessageLockLostException
Thrown if the message represented by
lockToken
has lost the message lock.
DeadLetter(Guid, IDictionary<string, object>)
Moves the undelivered message to the dead letter queue.
public void DeadLetter(Guid lockToken, IDictionary<string, object> propertiesToModify)
Parameters
lockToken
GuidThe lock token bound to the locked message instance.
propertiesToModify
IDictionary<string, object>The properties to modify.
DeadLetter(Guid, string, string)
Moves the undelivered message to the dead letter queue.
public void DeadLetter(Guid lockToken, string deadLetterReason, string deadLetterErrorDescription)
Parameters
lockToken
GuidThe lock token bound to the locked message instance.
deadLetterReason
stringThe reason for deadlettering the message.
deadLetterErrorDescription
stringThe error description for deadlettering the message.
Exceptions
- TimeoutException
Thrown if the operation exceeded the timeout value set by OperationTimeout.
- OperationCanceledException
Thrown if the client entity has been closed or aborted.
- MessageLockLostException
Thrown if the message represented by
lockToken
has lost the message lock.
DeadLetterAsync(Guid)
Asynchronously moves the undelivered message to the dead letter queue.
public Task DeadLetterAsync(Guid lockToken)
Parameters
lockToken
GuidThe lock token bound to the locked message instance.
Returns
- Task
A task instance that represents the asynchronous deadletter operation.
DeadLetterAsync(Guid, IDictionary<string, object>)
Asynchronously moves the undelivered message to the dead letter queue.
public Task DeadLetterAsync(Guid lockToken, IDictionary<string, object> propertiesToModify)
Parameters
lockToken
GuidThe lock token bound to the locked message instance.
propertiesToModify
IDictionary<string, object>The properties to modify.
Returns
- Task
A task instance that represents the asynchronous deadletter operation.
DeadLetterAsync(Guid, string, string)
Asynchronously moves the undelivered message to the dead letter queue.
public Task DeadLetterAsync(Guid lockToken, string deadLetterReason, string deadLetterErrorDescription)
Parameters
lockToken
GuidThe lock token bound to the locked message instance.
deadLetterReason
stringThe reason for deadlettering the message.
deadLetterErrorDescription
stringThe error description for deadlettering the message.
Returns
- Task
A task instance that represents the asynchronous deadletter operation.
Defer(Guid)
Suspends the processing of a message.
public void Defer(Guid lockToken)
Parameters
lockToken
GuidThe lock token bound to the locked message instance.
Exceptions
- TimeoutException
Thrown if the operation exceeded the timeout value set by OperationTimeout.
- OperationCanceledException
Thrown if the client entity has been closed or aborted.
- MessageLockLostException
Thrown if the message represented by
lockToken
has lost the message lock.
Defer(Guid, IDictionary<string, object>)
Suspends the processing of a message.
public void Defer(Guid lockToken, IDictionary<string, object> propertiesToModify)
Parameters
lockToken
GuidThe lock token bound to the locked message instance.
propertiesToModify
IDictionary<string, object>The properties to modify.
DeferAsync(Guid)
Asynchronously suspends the processing of a message.
public Task DeferAsync(Guid lockToken)
Parameters
lockToken
GuidThe lock token bound to the locked message instance.
Returns
- Task
A task instance that represents the asynchronous defer operation.
DeferAsync(Guid, IDictionary<string, object>)
Asynchronously suspends the processing of a message.
public Task DeferAsync(Guid lockToken, IDictionary<string, object> propertiesToModify)
Parameters
lockToken
GuidThe lock token bound to the locked message instance.
propertiesToModify
IDictionary<string, object>The properties to modify.
Returns
- Task
A task instance that represents the asynchronous defer operation.
FormatDeadLetterPath(string, string)
Builds a format name deadletter path using the specified topic path and subscription name.
public static string FormatDeadLetterPath(string topicPath, string subscriptionName)
Parameters
topicPath
stringThe full pathname of the topic.
subscriptionName
stringThe name of the subscription.
Returns
- string
The string resulted from building the format name deadletter path using the specified topic path and subscription name.
FormatSubscriptionPath(string, string)
Builds a format name subscription path using the specified topic path and subscription name.
public static string FormatSubscriptionPath(string topicPath, string subscriptionName)
Parameters
topicPath
stringThe full pathname of the topic.
subscriptionName
stringThe name of the subscription.
Returns
- string
The string resulted from building the format name subscription path using the specified topic path and subscription name.
GetMessageSessions()
Gets a message session that allows grouping of related messages for processing in a single transaction.
public IEnumerable<MessageSession> GetMessageSessions()
Returns
- IEnumerable<MessageSession>
A message session that allows grouping of related messages for processing in a single transaction.
GetMessageSessions(DateTime)
Retrieves all message sessions whose session state was updated since lastUpdatedTime
.
public IEnumerable<MessageSession> GetMessageSessions(DateTime lastUpdatedTime)
Parameters
lastUpdatedTime
DateTimeThe time the session was last updated.
Returns
- IEnumerable<MessageSession>
A message session that allows grouping of related messages for processing in a single transaction.
GetMessageSessionsAsync()
Asynchronously gets a message session that allows grouping of related messages for processing in a single transaction.
public Task<IEnumerable<MessageSession>> GetMessageSessionsAsync()
Returns
- Task<IEnumerable<MessageSession>>
A task instance that represents the asynchronous get message sessions operation.
GetMessageSessionsAsync(DateTime)
Asynchronously gets a message session that allows grouping of related messages for processing in a single transaction.
public Task<IEnumerable<MessageSession>> GetMessageSessionsAsync(DateTime lastUpdatedTime)
Parameters
lastUpdatedTime
DateTimeThe time the session was last updated.
Returns
- Task<IEnumerable<MessageSession>>
A task instance that represents the asynchronous get message sessions operation.
OnAbort()
Executes the abort action.
protected override void OnAbort()
OnBeginAcceptMessageSession(string, ReceiveMode, TimeSpan, TimeSpan, AsyncCallback, object)
Executes upon calling the BeginAcceptMessageSession operation.
protected abstract IAsyncResult OnBeginAcceptMessageSession(string sessionId, ReceiveMode receiveMode, TimeSpan serverWaitTime, TimeSpan timeout, AsyncCallback callback, object state)
Parameters
sessionId
stringThe session identifier of the message session.
receiveMode
ReceiveModeThe receive mode when processing with the receive messages.
serverWaitTime
TimeSpanThe time span the server waits for processing messages before it times out
timeout
TimeSpanThe time span the server waits for processing messages before it times out.
callback
AsyncCallbackAn AsyncCallback delegate that references the method to invoke when the operation is complete.
state
objectA user-defined object that contains state information about the asynchronous operation.
Returns
- IAsyncResult
An IAsyncResult that references the asynchronous operation to accept a message session.
OnBeginAddRule(RuleDescription, TimeSpan, AsyncCallback, object)
Executes upon calling the BeginAddRule operation.
protected abstract IAsyncResult OnBeginAddRule(RuleDescription description, TimeSpan timeout, AsyncCallback callback, object state)
Parameters
description
RuleDescriptionThe rule description that provides metadata of the rule to add.
timeout
TimeSpanThe time span this operation waits before it times out.
callback
AsyncCallbackAn AsyncCallback delegate that references the method to invoke when the operation is complete.
state
objectA user-defined object that contains state information about the asynchronous operation.
Returns
- IAsyncResult
An IAsyncResult that references the asynchronous operation to add a new rule to the subscription.
OnBeginClose(TimeSpan, AsyncCallback, object)
Executes the begin close action.
protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
Parameters
timeout
TimeSpanThe wait time before the operation times out.
callback
AsyncCallbackAn AsyncCallback delegate that references the method to invoke when the operation is complete.
state
objectA user-defined object that contains information about the receive operation. This object is passed to the BeginClose delegate when the operation is complete.
Returns
- IAsyncResult
An IAsyncResultthat references the asynchronous BeginClose.
OnBeginCreateReceiver(ReceiveMode, TimeSpan, AsyncCallback, object)
Executes the begin create receiver action.
protected abstract IAsyncResult OnBeginCreateReceiver(ReceiveMode receiveMode, TimeSpan timeout, AsyncCallback callback, object state)
Parameters
receiveMode
ReceiveModeThe message ReceiveMode.
timeout
TimeSpanThe wait time before the operation times out.
callback
AsyncCallbackAn AsyncCallback delegate that references the method to invoke when the operation is complete.
state
objectA user-defined object that contains information about the receive operation. This object is passed to the Microsoft.ServiceBus.Messaging.SubscriptionClient.EndCreateReceiver(System.IAsyncResult) delegate when the operation is complete.
Returns
- IAsyncResult
An IAsyncResult that references the asynchronous Microsoft.ServiceBus.Messaging.SubscriptionClient.CreateReceiver(Microsoft.ServiceBus.Messaging.ReceiveMode).
OnBeginCreateReceiver(string, string, ReceiveMode, TimeSpan, AsyncCallback, object)
Executes the begin create receiver action.
protected abstract IAsyncResult OnBeginCreateReceiver(string subQueuePath, string subQueueName, ReceiveMode receiveMode, TimeSpan timeout, AsyncCallback callback, object state)
Parameters
subQueuePath
stringThe path of the subqueue.
subQueueName
stringThe name of the subqueue.
receiveMode
ReceiveModeThe message ReceiveMode.
timeout
TimeSpanThe wait time before the operation times out.
callback
AsyncCallbackAn AsyncCallback delegate that references the method to invoke when the operation is complete.
state
objectA user-defined object that contains information about the receive operation. This object is passed to the Microsoft.ServiceBus.Messaging.SubscriptionClient.EndCreateReceiver(System.IAsyncResult) delegate when the operation is complete.
Returns
- IAsyncResult
An IAsyncResult that references the asynchronous Microsoft.ServiceBus.Messaging.SubscriptionClient.CreateReceiver(System.String,Microsoft.ServiceBus.Messaging.ReceiveMode).
OnBeginGetMessageSessions(DateTime, AsyncCallback, object)
Executes upon calling the BeginGetMessageSessions operation.
protected abstract IAsyncResult OnBeginGetMessageSessions(DateTime lastUpdatedTime, AsyncCallback callback, object state)
Parameters
lastUpdatedTime
DateTimeThe time the session was last updated.
callback
AsyncCallbackAn AsyncCallback delegate that references the method to invoke when the operation is complete.
state
objectA user-defined object that contains state information about the asynchronous operation.
Returns
- IAsyncResult
An IAsyncResult that references the asynchronous operation to add a new rule to the subscription.
OnBeginRemoveRule(string, TimeSpan, AsyncCallback, object)
Begins removing a Microsoft.ServiceBus.Messaging.Rule from a Microsoft.ServiceBus.Messaging.Subscription through the run-time client protocol.
protected abstract IAsyncResult OnBeginRemoveRule(string ruleName, TimeSpan timeout, AsyncCallback callback, object state)
Parameters
ruleName
stringThe name of the rule to remove.
timeout
TimeSpanThe wait time before the operation times out.
callback
AsyncCallbackAn AsyncCallback delegate that references the method to invoke when the operation is complete.
state
objectA user-defined object that contains information about the receive operation. This object is passed to the RemoveRule(string) delegate when the operation is complete.
Returns
- IAsyncResult
An IAsyncResult that references the asynchronous RemoveRule(string).
OnBeginRemoveRulesByTag(string, TimeSpan, AsyncCallback, object)
Begins removing a Microsoft.ServiceBus.Messaging.Rule from a Microsoft.ServiceBus.Messaging.Subscription through the run-time client protocol using a tag.
protected abstract IAsyncResult OnBeginRemoveRulesByTag(string tag, TimeSpan timeout, AsyncCallback callback, object state)
Parameters
tag
stringThe tag to be used.
timeout
TimeSpanThe wait time before the operation times out.
callback
AsyncCallbackAn AsyncCallback delegate that references the method to invoke when the operation is complete.
state
objectA user-defined object that contains information about the receive operation. This object is passed to the RemoveRule(string) delegate when the operation is complete.
Returns
- IAsyncResult
An IAsyncResult that references the asynchronous operation to add a new rule to the subscription.
OnClose(TimeSpan)
Executes the close action.
protected override void OnClose(TimeSpan timeout)
Parameters
timeout
TimeSpanThe wait time before the operation times out.
OnEndAcceptMessageSession(IAsyncResult)
Executes upon calling the EndAcceptMessageSession operation.
protected abstract MessageSession OnEndAcceptMessageSession(IAsyncResult result)
Parameters
result
IAsyncResultAn IAsyncResult that represents the status of the asynchronous accept message session operation.
Returns
- MessageSession
The MessageSession that allows grouping of related messages for processing in a single transaction.
OnEndAddRule(IAsyncResult)
Ends the asynchronous call to OnBeginAddRule(RuleDescription, TimeSpan, AsyncCallback, object).
protected abstract void OnEndAddRule(IAsyncResult result)
Parameters
result
IAsyncResultAn IAsyncResult from a OnBeginAddRule(RuleDescription, TimeSpan, AsyncCallback, object).
OnEndClose(IAsyncResult)
Executes the end close action.
protected override void OnEndClose(IAsyncResult result)
Parameters
result
IAsyncResultAn IAsyncResult that references the asynchronous BeginClose.
OnEndCreateReceiver(IAsyncResult)
Executes the end create receiver action.
protected abstract MessageReceiver OnEndCreateReceiver(IAsyncResult result)
Parameters
result
IAsyncResultAn IAsyncResult object that references the Microsoft.ServiceBus.Messaging.SubscriptionClient.EndCreateReceiver(System.IAsyncResult).
Returns
- MessageReceiver
A newly-created MessageReceiver object.
OnEndGetMessageSessions(IAsyncResult)
Executes the end get message action.
protected abstract IEnumerable<MessageSession> OnEndGetMessageSessions(IAsyncResult result)
Parameters
result
IAsyncResultThe result of the message.
Returns
- IEnumerable<MessageSession>
The end get message action.
OnEndRemoveRule(IAsyncResult)
Ends the asynchronous call to OnBeginRemoveRule(string, TimeSpan, AsyncCallback, object).
protected abstract void OnEndRemoveRule(IAsyncResult result)
Parameters
result
IAsyncResultAn IAsyncResult from a OnBeginRemoveRule(string, TimeSpan, AsyncCallback, object).
OnEndRemoveRules(IAsyncResult)
Ends the asynchronous call to OnBeginRemoveRule(string, TimeSpan, AsyncCallback, object).
protected abstract void OnEndRemoveRules(IAsyncResult result)
Parameters
result
IAsyncResultThe result of the asynchronization.
OnMessage(Action<BrokeredMessage>)
Processes a message in an event-driven message pump.
public void OnMessage(Action<BrokeredMessage> callback)
Parameters
callback
Action<BrokeredMessage>The method to invoke when the operation is complete.
OnMessage(Action<BrokeredMessage>, OnMessageOptions)
Processes a message in an event-driven message pump, with the given set of OnMessageOptions options.
public void OnMessage(Action<BrokeredMessage> callback, OnMessageOptions onMessageOptions)
Parameters
callback
Action<BrokeredMessage>The method to invoke when the operation is complete.
onMessageOptions
OnMessageOptionsSpecifies the OnMessageOptions options with which to instantiate the message pump.
OnMessageAsync(Func<BrokeredMessage, Task>)
Asynchronously processes a message.
public void OnMessageAsync(Func<BrokeredMessage, Task> callback)
Parameters
callback
Func<BrokeredMessage, Task>The asynchronous method to invoke when the operation is complete.
OnMessageAsync(Func<BrokeredMessage, Task>, OnMessageOptions)
Asynchronously processes a message.
public void OnMessageAsync(Func<BrokeredMessage, Task> callback, OnMessageOptions onMessageOptions)
Parameters
callback
Func<BrokeredMessage, Task>The asynchronous method to invoke when the operation is complete.
onMessageOptions
OnMessageOptionsThe options associated with the message.
Peek()
Returns without removing the first message in the queue.
public BrokeredMessage Peek()
Returns
- BrokeredMessage
The returned message.
Peek(long)
Returns without removing the first message in the queue.
public BrokeredMessage Peek(long fromSequenceNumber)
Parameters
fromSequenceNumber
longThe starting point from which to browse a message.
Returns
- BrokeredMessage
The returned message.
PeekAsync()
Asynchronously returns without removing the first message in the queue.
public Task<BrokeredMessage> PeekAsync()
Returns
- Task<BrokeredMessage>
A task instance that represents the asynchronous peek operation.
PeekAsync(long)
Asynchronously returns without removing the first message in the queue.
public Task<BrokeredMessage> PeekAsync(long fromSequenceNumber)
Parameters
fromSequenceNumber
longThe starting point from which to browse a message.
Returns
- Task<BrokeredMessage>
A task instance that represents the asynchronous peek operation.
PeekBatch(int)
Returns without removing the first messages in a batch.
public IEnumerable<BrokeredMessage> PeekBatch(int messageCount)
Parameters
messageCount
intThe number of messages in a batch.
Returns
- IEnumerable<BrokeredMessage>
The collection of first messages in a batch.
PeekBatch(long, int)
Returns without removing the first messages in a batch.
public IEnumerable<BrokeredMessage> PeekBatch(long fromSequenceNumber, int messageCount)
Parameters
fromSequenceNumber
longThe starting point from which to browse a message.
messageCount
intThe number of messages in a batch.
Returns
- IEnumerable<BrokeredMessage>
The collection of first messages in a batch.
PeekBatchAsync(int)
Asynchronously returns without removing the first messages in a batch.
public Task<IEnumerable<BrokeredMessage>> PeekBatchAsync(int messageCount)
Parameters
messageCount
intThe number of messages in a batch.
Returns
- Task<IEnumerable<BrokeredMessage>>
A task instance that represents the asynchronous peek batch operation.
PeekBatchAsync(long, int)
Asynchronously returns without removing the first messages in a batch.
public Task<IEnumerable<BrokeredMessage>> PeekBatchAsync(long fromSequenceNumber, int messageCount)
Parameters
fromSequenceNumber
longThe starting point from which to browse a message.
messageCount
intThe number of messages in a batch.
Returns
- Task<IEnumerable<BrokeredMessage>>
A task instance that represents the asynchronous peek batch operation.
Receive()
Receives a message using the Microsoft.ServiceBus.Messaging.QueueClient.InternalReceiver.
public BrokeredMessage Receive()
Returns
- BrokeredMessage
The BrokeredMessage that represents the received message.
Exceptions
- MessagingEntityNotFoundException
Thrown when the subscription does not exist.
- TimeoutException
Thrown if the operation exceeded the timeout value set via OperationTimeout.
- OperationCanceledException
Thrown if the client entity has been closed or aborted.
- UnauthorizedAccessException
Thrown if there is an authentication error.
Receive(long)
Receives a message using the Microsoft.ServiceBus.Messaging.QueueClient.InternalReceiver.
public BrokeredMessage Receive(long sequenceNumber)
Parameters
sequenceNumber
longThe sequence number of the deferred message to receive.
Returns
- BrokeredMessage
The BrokeredMessage that represents the received message.
Exceptions
- OperationCanceledException
Thrown if the client entity has been closed or aborted.
Receive(TimeSpan)
Receives a message using the Microsoft.ServiceBus.Messaging.QueueClient.InternalReceiver.
public BrokeredMessage Receive(TimeSpan serverWaitTime)
Parameters
serverWaitTime
TimeSpanThe time span the server waits for receiving a message before it times out.
Returns
- BrokeredMessage
The BrokeredMessage that represents the received message.
Exceptions
- ArgumentOutOfRangeException
Thrown if the
serverWaitTime
is negative.- MessagingEntityNotFoundException
Thrown when the subscription does not exist.
- OperationCanceledException
Thrown if the client entity has been closed or aborted.
- TimeoutException
Thrown if the operation exceeded the timeout value set via OperationTimeout.
- UnauthorizedAccessException
Thrown if there is an authentication error.
ReceiveAsync()
Asynchronously receives a message using the Microsoft.ServiceBus.Messaging.QueueClient.InternalReceiver.
public Task<BrokeredMessage> ReceiveAsync()
Returns
- Task<BrokeredMessage>
A task instance that represents the asynchronous receive operation.
ReceiveAsync(long)
Asynchronously receives a message using the Microsoft.ServiceBus.Messaging.QueueClient.InternalReceiver.
public Task<BrokeredMessage> ReceiveAsync(long sequenceNumber)
Parameters
sequenceNumber
longThe sequence number of the deferred message to receive.
Returns
- Task<BrokeredMessage>
A task instance that represents the asynchronous receive operation.
ReceiveAsync(TimeSpan)
Asynchronously receives a message using the Microsoft.ServiceBus.Messaging.QueueClient.InternalReceiver.
public Task<BrokeredMessage> ReceiveAsync(TimeSpan serverWaitTime)
Parameters
serverWaitTime
TimeSpanThe time span the server waits for receiving a message before it times out.
Returns
- Task<BrokeredMessage>
A task instance that represents the asynchronous receive operation.
ReceiveBatch(IEnumerable<long>)
Receives a batch after the asynchronous operation.
public IEnumerable<BrokeredMessage> ReceiveBatch(IEnumerable<long> sequenceNumbers)
Parameters
sequenceNumbers
IEnumerable<long>The sequence number.
Returns
- IEnumerable<BrokeredMessage>
A batch after the asynchronous operation.
ReceiveBatch(int)
Receives a batch after the asynchronous operation.
public IEnumerable<BrokeredMessage> ReceiveBatch(int messageCount)
Parameters
messageCount
intThe maximum number of messages to return in the batch. As this is an approximation, fewer messages may be returned even if the number of messages is higher than
messageCount
.
Returns
- IEnumerable<BrokeredMessage>
A batch after the asynchronous operation.
ReceiveBatch(int, TimeSpan)
Receives a batch after the asynchronous operation.
public IEnumerable<BrokeredMessage> ReceiveBatch(int messageCount, TimeSpan serverWaitTime)
Parameters
messageCount
intThe maximum number of messages to receive in a batch.
serverWaitTime
TimeSpanThe time span the server waits for processing messages.
Returns
- IEnumerable<BrokeredMessage>
A batch after the asynchronous operation.
ReceiveBatchAsync(IEnumerable<long>)
Asynchronously receives a set of messages (for batch processing).
public Task<IEnumerable<BrokeredMessage>> ReceiveBatchAsync(IEnumerable<long> sequenceNumbers)
Parameters
sequenceNumbers
IEnumerable<long>The sequence number.
Returns
- Task<IEnumerable<BrokeredMessage>>
A task instance that represents the asynchronous receive batch operation.
ReceiveBatchAsync(int)
Asynchronously receives a set of messages (for batch processing).
public Task<IEnumerable<BrokeredMessage>> ReceiveBatchAsync(int messageCount)
Parameters
messageCount
intThe maximum number of messages to return in the batch.
Returns
- Task<IEnumerable<BrokeredMessage>>
A task instance that represents the asynchronous receive batch operation.
ReceiveBatchAsync(int, TimeSpan)
Asynchronously receives a set of messages (for batch processing).
public Task<IEnumerable<BrokeredMessage>> ReceiveBatchAsync(int messageCount, TimeSpan serverWaitTime)
Parameters
messageCount
intThe maximum number of messages to return in the batch.
serverWaitTime
TimeSpanThe time span the server waits for processing messages.
Returns
- Task<IEnumerable<BrokeredMessage>>
A task instance that represents the asynchronous receive batch operation.
RegisterSessionHandler(Type)
Registers the handler for the client session.
public void RegisterSessionHandler(Type handlerType)
Parameters
handlerType
TypeThe type of the handler.
RegisterSessionHandler(Type, SessionHandlerOptions)
Registers the handler for the client session.
public void RegisterSessionHandler(Type handlerType, SessionHandlerOptions options)
Parameters
handlerType
TypeThe type of the handler.
options
SessionHandlerOptionsThe session handler options.
RegisterSessionHandlerAsync(Type)
Asynchronously registers the handler for the client session.
public Task RegisterSessionHandlerAsync(Type handlerType)
Parameters
handlerType
TypeThe type of the handler.
Returns
- Task
The task object representing the asynchronous operation.
RegisterSessionHandlerAsync(Type, SessionHandlerOptions)
Asynchronously registers the handler for the client session.
public Task RegisterSessionHandlerAsync(Type handlerType, SessionHandlerOptions options)
Parameters
handlerType
TypeThe type of the handler.
options
SessionHandlerOptionsThe session handler options.
Returns
- Task
The task object representing the asynchronous operation.
RegisterSessionHandlerFactory(IMessageSessionAsyncHandlerFactory, SessionHandlerOptions)
Registers the handler factory for the client session.
public void RegisterSessionHandlerFactory(IMessageSessionAsyncHandlerFactory factory, SessionHandlerOptions options)
Parameters
factory
IMessageSessionAsyncHandlerFactoryThe interface for the handler factory associated with the message session.
options
SessionHandlerOptionsThe session handler options.
RegisterSessionHandlerFactory(IMessageSessionHandlerFactory, SessionHandlerOptions)
Registers the handler factory for the client session.
public void RegisterSessionHandlerFactory(IMessageSessionHandlerFactory factory, SessionHandlerOptions options)
Parameters
factory
IMessageSessionHandlerFactoryThe interface for the handler factory associated with the message session.
options
SessionHandlerOptionsThe session handler options.
RegisterSessionHandlerFactoryAsync(IMessageSessionAsyncHandlerFactory, SessionHandlerOptions)
Asynchronously registers the handler factory for the client session.
public Task RegisterSessionHandlerFactoryAsync(IMessageSessionAsyncHandlerFactory factory, SessionHandlerOptions options)
Parameters
factory
IMessageSessionAsyncHandlerFactoryThe interface for the handler factory associated with the message session.
options
SessionHandlerOptionsThe session handler options.
Returns
- Task
The task object representing the asynchronous operation.
RegisterSessionHandlerFactoryAsync(IMessageSessionHandlerFactory, SessionHandlerOptions)
Asynchronously registers the handler factory for the client session.
public Task RegisterSessionHandlerFactoryAsync(IMessageSessionHandlerFactory factory, SessionHandlerOptions options)
Parameters
factory
IMessageSessionHandlerFactoryThe interface for the handler factory associated with the message session.
options
SessionHandlerOptionsThe session handler options.
Returns
- Task
The task object representing the asynchronous operation.
RemoveRule(string)
Removes the rule described by ruleName
.
public void RemoveRule(string ruleName)
Parameters
ruleName
stringThe name of the rule.
Exceptions
- MessagingEntityNotFoundException
Thrown when rule does not exist.
- ArgumentException
Thrown if
description.Name
is null, white space empty or not in the right format.- TimeoutException
Thrown if the operation exceeded the timeout value set via OperationTimeout.
- OperationCanceledException
Thrown if the client entity has been closed or aborted.
RemoveRuleAsync(string)
Asynchronously removes the rule described by ruleName
.
public Task RemoveRuleAsync(string ruleName)
Parameters
ruleName
stringThe name of the rule.
Returns
- Task
A task instance that represents the asynchronous remove rule operation.
RenewMessageLock(Guid)
public DateTime RenewMessageLock(Guid lockToken)
Parameters
lockToken
Guid
Returns
RenewMessageLockAsync(Guid)
public Task<DateTime> RenewMessageLockAsync(Guid lockToken)
Parameters
lockToken
Guid