共用方式為


ISessionClient Interface

Definition

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

public interface ISessionClient : Microsoft.Azure.ServiceBus.IClientEntity
type ISessionClient = interface
    interface IClientEntity
Public Interface ISessionClient
Implements IClientEntity
Derived
Implements

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.

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();

Properties

ClientId

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

(Inherited from IClientEntity)
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 IClientEntity)
OperationTimeout

Duration after which individual operations will timeout.

(Inherited from IClientEntity)
OwnsConnection

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

(Inherited from IClientEntity)
Path

Gets the entity path.

(Inherited from IClientEntity)
RegisteredPlugins

Gets a list of currently registered plugins for this client.

(Inherited from IClientEntity)
ServiceBusConnection

Connection object to the service bus namespace.

(Inherited from IClientEntity)

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 IClientEntity)
RegisterPlugin(ServiceBusPlugin)

Registers a ServiceBusPlugin to be used with this client.

(Inherited from IClientEntity)
UnregisterPlugin(String)

Unregisters a ServiceBusPlugin.

(Inherited from IClientEntity)

Applies to

See also