Bagikan melalui


ServiceBusSessionReceiver Class

Definition

The ServiceBusSessionReceiver is responsible for receiving ServiceBusReceivedMessage and settling messages from session-enabled Queues and Subscriptions. It is constructed by calling AcceptNextSessionAsync(String, String, ServiceBusSessionReceiverOptions, CancellationToken).

public class ServiceBusSessionReceiver : Azure.Messaging.ServiceBus.ServiceBusReceiver
type ServiceBusSessionReceiver = class
    inherit ServiceBusReceiver
Public Class ServiceBusSessionReceiver
Inherits ServiceBusReceiver
Inheritance
ServiceBusSessionReceiver

Constructors

ServiceBusSessionReceiver()

Initializes a new instance of the ServiceBusSessionReceiver class for mocking.

Properties

EntityPath

The path of the Service Bus entity that the receiver is connected to, specific to the Service Bus namespace that contains it.

(Inherited from ServiceBusReceiver)
FullyQualifiedNamespace

The fully qualified Service Bus namespace that the receiver is associated with. This is likely to be similar to {yournamespace}.servicebus.windows.net.

(Inherited from ServiceBusReceiver)
Identifier

A name used to identify the receiver client. If null or empty, a random unique value will be will be used.

(Inherited from ServiceBusReceiver)
IsClosed

Indicates whether or not this ServiceBusSessionReceiver has been closed by the user, or whether the underlying session link was closed due to either losing the session lock or having the link disconnected. If this is true, the receiver cannot be used for any more operations. If this is false, it is still possible that the session lock has been lost so it is important to still handle ServiceBusException with Reason equal to SessionLockLost.

PrefetchCount

The number of messages that will be eagerly requested from Queues or Subscriptions and queued locally without regard to whether a processing is currently active, intended to help maximize throughput by allowing the receiver to receive from a local cache rather than waiting on a service request

(Inherited from ServiceBusReceiver)
ReceiveMode

The ReceiveMode used to specify how messages are received.

(Inherited from ServiceBusReceiver)
SessionId

The Session Id associated with the receiver.

SessionLockedUntil

Gets the DateTimeOffset that the receiver's session is locked until.

Methods

AbandonMessageAsync(ServiceBusReceivedMessage, IDictionary<String,Object>, CancellationToken)

Abandons a ServiceBusReceivedMessage.This will make the message available again for immediate processing as the lock on the message held by the receiver will be released.

(Inherited from ServiceBusReceiver)
CloseAsync(CancellationToken)

Performs the task needed to clean up resources used by the ServiceBusReceiver.

(Inherited from ServiceBusReceiver)
CompleteMessageAsync(ServiceBusReceivedMessage, CancellationToken)

Completes a ServiceBusReceivedMessage. This will delete the message from the service.

(Inherited from ServiceBusReceiver)
DeadLetterMessageAsync(ServiceBusReceivedMessage, IDictionary<String,Object>, CancellationToken)

Moves a message to the dead-letter subqueue.

(Inherited from ServiceBusReceiver)
DeadLetterMessageAsync(ServiceBusReceivedMessage, IDictionary<String,Object>, String, String, CancellationToken)

Moves a message to the dead-letter subqueue.

(Inherited from ServiceBusReceiver)
DeadLetterMessageAsync(ServiceBusReceivedMessage, String, String, CancellationToken)

Moves a message to the dead-letter subqueue.

(Inherited from ServiceBusReceiver)
DeferMessageAsync(ServiceBusReceivedMessage, IDictionary<String,Object>, CancellationToken)

Indicates that the receiver wants to defer the processing for the message.

(Inherited from ServiceBusReceiver)
DeleteMessagesAsync(Int32, Nullable<DateTimeOffset>, CancellationToken)

Deletes up to messageCount messages from the entity. The actual number of deleted messages may be less if there are fewer eligible messages in the entity.

(Inherited from ServiceBusReceiver)
DisposeAsync()

Performs the task needed to clean up resources used by the ServiceBusReceiver. This is equivalent to calling CloseAsync(CancellationToken).

(Inherited from ServiceBusReceiver)
GetSessionStateAsync(CancellationToken)

Gets the session state.

PeekMessageAsync(Nullable<Int64>, CancellationToken)

Fetches the next active ServiceBusReceivedMessage without changing the state of the receiver or the message source.

(Inherited from ServiceBusReceiver)
PeekMessagesAsync(Int32, Nullable<Int64>, CancellationToken)

Fetches a list of active messages without changing the state of the receiver or the message source.

(Inherited from ServiceBusReceiver)
PurgeMessagesAsync(Nullable<DateTimeOffset>, CancellationToken)

Attempts to purge all messages from an entity. Locked messages are not eligible for removal and will remain in the entity.

(Inherited from ServiceBusReceiver)
ReceiveDeferredMessageAsync(Int64, CancellationToken)

Receives a deferred message identified by sequenceNumber.

(Inherited from ServiceBusReceiver)
ReceiveDeferredMessagesAsync(IEnumerable<Int64>, CancellationToken)

Receives a list of deferred messages identified by sequenceNumbers.

(Inherited from ServiceBusReceiver)
ReceiveMessageAsync(Nullable<TimeSpan>, CancellationToken)

Receives a ServiceBusReceivedMessage from the entity using ReceiveMode mode. ReceiveMode defaults to PeekLock mode.

(Inherited from ServiceBusReceiver)
ReceiveMessagesAsync(CancellationToken)

Receives messages as an asynchronous enumerable from the entity using ReceiveMode mode. ReceiveMode defaults to PeekLock mode. Messages will be received from the entity as the IAsyncEnumerable is iterated. If no messages are available, this method will continue polling until messages are available, i.e. it will never return null.

(Inherited from ServiceBusReceiver)
ReceiveMessagesAsync(Int32, Nullable<TimeSpan>, CancellationToken)

Receives a list of ServiceBusReceivedMessage from the entity using ReceiveMode mode. ReceiveMode defaults to PeekLock mode. This method doesn't guarantee to return exact maxMessages messages, even if there are maxMessages messages available in the queue or topic.

(Inherited from ServiceBusReceiver)
RenewMessageLockAsync(ServiceBusReceivedMessage, CancellationToken)

Renews the lock on the message. The lock will be renewed based on the setting specified on the queue.

(Inherited from ServiceBusReceiver)
RenewSessionLockAsync(CancellationToken)

Renews the lock on the session specified by the SessionId. The lock will be renewed based on the setting specified on the entity.

SetSessionStateAsync(BinaryData, CancellationToken)

Set a custom state on the session which can be later retrieved using GetSessionStateAsync(CancellationToken)

Applies to