다음을 통해 공유


SessionClient Class

Definition

A session client can be used to accept session objects which can be used to interact with all messages with the same sessionId.

public sealed class SessionClient : Microsoft.Azure.ServiceBus.ClientEntity, Microsoft.Azure.ServiceBus.ISessionClient
type SessionClient = class
    inherit ClientEntity
    interface ISessionClient
    interface IClientEntity
Public NotInheritable Class SessionClient
Inherits ClientEntity
Implements ISessionClient
Inheritance
SessionClient
Implements

Examples

To create a new SessionClient

ISessionClient sessionClient = new SessionClient(
    namespaceConnectionString,
    queueName,
    ReceiveMode.PeekLock);

To receive a session object for a given sessionId

IMessageSession session = await sessionClient.AcceptMessageSessionAsync(sessionId);

To receive any session

IMessageSession session = await sessionClient.AcceptMessageSessionAsync();

Remarks

You can accept any session or a given session (identified by SessionId using a session client. Once you accept a session, you can use it as a MessageReceiver which receives only messages having the same session id. See IMessageSession for usage of session object. This uses AMQP protocol to communicate with the service.

Constructors

SessionClient(ServiceBusConnection, String, ReceiveMode, RetryPolicy, Int32)

Creates a new SessionClient on a given ServiceBusConnection

SessionClient(ServiceBusConnectionStringBuilder, ReceiveMode, RetryPolicy, Int32)

Creates a new SessionClient from a ServiceBusConnectionStringBuilder

SessionClient(String, String, ITokenProvider, TransportType, ReceiveMode, RetryPolicy, Int32)

Creates a new SessionClient from a specified endpoint, entity path, and token provider.

SessionClient(String, String, ReceiveMode, RetryPolicy, Int32)

Creates a new SessionClient from a specified connection string and entity path.

Properties

ClientId

Gets the ID to identify this client. This can be used to correlate logs and exceptions.

(Inherited from ClientEntity)
EntityPath

Gets the path of the entity. This is either the name of the queue, or the full path of the subscription.

IsClosedOrClosing

Returns true if the client is closed or closing.

(Inherited from ClientEntity)
OperationTimeout

Duration after which individual operations will timeout.

OwnsConnection

Returns true if connection is owned and false if connection is shared.

(Inherited from ClientEntity)
Path

Gets the path of the entity. This is either the name of the queue, or the full path of the subscription.

RegisteredPlugins

Gets a list of currently registered plugins.

RetryPolicy

Gets the RetryPolicy defined on the client.

(Inherited from ClientEntity)
ServiceBusConnection

Connection object to the service bus namespace.

Methods

AcceptMessageSessionAsync()

Gets a session object of any SessionId that can be used to receive messages for that sessionId.

AcceptMessageSessionAsync(String, TimeSpan)

Gets a particular session object identified by sessionId that can be used to receive messages for that sessionId.

AcceptMessageSessionAsync(String)

Gets a particular session object identified by sessionId that can be used to receive messages for that sessionId.

AcceptMessageSessionAsync(TimeSpan)

Gets a session object of any SessionId that can be used to receive messages for that sessionId.

CloseAsync()

Closes the Client. Closes the connections opened by it.

(Inherited from ClientEntity)
OnClosingAsync() (Inherited from ClientEntity)
RegisterPlugin(ServiceBusPlugin)

Registers a ServiceBusPlugin to be used with this receiver.

ThrowIfClosed()

Throw an OperationCanceledException if the object is Closing.

(Inherited from ClientEntity)
UnregisterPlugin(String)

Unregisters a ServiceBusPlugin.

Applies to

See also