Share via


ProcessSessionMessageEventArgs.SetSessionStateAsync Method

Definition

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