Interface ISessionClient
- Namespace
- Microsoft.Azure.ServiceBus
- Assembly
- Microsoft.Azure.ServiceBus.dll
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 : IClientEntity
- Inherited Members
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.
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
EntityPath
Gets the path of the entity. This is either the name of the queue, or the full path of the subscription.
string EntityPath { get; }
Property Value
Methods
AcceptMessageSessionAsync()
Gets a session object of any SessionId that can be used to receive messages for that sessionId.
Task<IMessageSession> AcceptMessageSessionAsync()
Returns
Remarks
All plugins registered on SessionClient will be applied to each MessageSession that is accepted. Individual sessions can further register additional plugins.
AcceptMessageSessionAsync(string)
Gets a particular session object identified by sessionId
that can be used to receive messages for that sessionId.
Task<IMessageSession> AcceptMessageSessionAsync(string sessionId)
Parameters
sessionId
stringThe sessionId present in all its messages.
Returns
Remarks
All plugins registered on SessionClient will be applied to each MessageSession that is accepted. Individual sessions can further register additional plugins.
AcceptMessageSessionAsync(string, TimeSpan)
Gets a particular session object identified by sessionId
that can be used to receive messages for that sessionId.
Task<IMessageSession> AcceptMessageSessionAsync(string sessionId, TimeSpan serverWaitTime)
Parameters
sessionId
stringThe sessionId present in all its messages.
serverWaitTime
TimeSpanAmount of time for which the call should wait for to fetch the next session.
Returns
Remarks
All plugins registered on SessionClient will be applied to each MessageSession that is accepted. Individual sessions can further register additional plugins.
AcceptMessageSessionAsync(TimeSpan)
Gets a session object of any SessionId that can be used to receive messages for that sessionId.
Task<IMessageSession> AcceptMessageSessionAsync(TimeSpan serverWaitTime)
Parameters
serverWaitTime
TimeSpanAmount of time for which the call should wait for to fetch the next session.
Returns
Remarks
All plugins registered on SessionClient will be applied to each MessageSession that is accepted. Individual sessions can further register additional plugins.