Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

ServiceBusSessionReceiver.SetSessionStateAsync Method

Definition

Namespace:
Azure.Messaging.ServiceBus
Assembly:
Azure.Messaging.ServiceBus.dll
Package:
Azure.Messaging.ServiceBus v7.20.1
Package:
Azure.Messaging.ServiceBus v7.18.0-beta.1
Source:
ServiceBusSessionReceiver.cs
Source:
ServiceBusSessionReceiver.cs

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

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

public virtual System.Threading.Tasks.Task SetSessionStateAsync(BinaryData sessionState, System.Threading.CancellationToken cancellationToken = default);
abstract member SetSessionStateAsync : BinaryData * System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.SetSessionStateAsync : BinaryData * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Overridable Function SetSessionStateAsync (sessionState As BinaryData, Optional cancellationToken As CancellationToken = Nothing) As Task

Parameters

sessionState
BinaryData

A BinaryData of session state

cancellationToken
CancellationToken

An optional CancellationToken instance to signal the request to cancel the operation.

Returns

A task to be resolved on when the operation has completed.

Exceptions

The lock for the session has expired. The Reason will be set to SessionLockLost in this case.

Remarks

This state is stored on Service Bus forever unless you set an empty state on it.

Applies to


Feedback

Was this page helpful?