Share via


IMessageSession Interface

Definition

Describes a Session object. IMessageSession can be used to perform operations on sessions.

public interface IMessageSession : Microsoft.Azure.ServiceBus.Core.IMessageReceiver
type IMessageSession = interface
    interface IMessageReceiver
    interface IReceiverClient
    interface IClientEntity
Public Interface IMessageSession
Implements IMessageReceiver
Implements

Remarks

Service Bus Sessions, also called 'Groups' in the AMQP 1.0 protocol, are unbounded sequences of related messages. ServiceBus guarantees ordering of messages in a session.

Any sender can create a session when submitting messages into a Topic or Queue by setting the SessionId property on Message to some application defined unique identifier. At the AMQP 1.0 protocol level, this value maps to the group-id property.

Sessions come into existence when there is at least one message with the session's SessionId in the Queue or Topic subscription. Once a Session exists, there is no defined moment or gesture for when the session expires or disappears.

Properties

ClientId

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

(Inherited from IClientEntity)
IsClosedOrClosing

Returns true if the client is closed or closing.

(Inherited from IClientEntity)
LastPeekedSequenceNumber

Gets the sequence number of the last peeked message.

(Inherited from IMessageReceiver)
LockedUntilUtc

Gets the time that the session identified by SessionId is locked until for this client.

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)
PrefetchCount

Prefetch speeds up the message flow by aiming to have a message readily available for local retrieval when and before the application asks for one using Receive. Setting a non-zero value prefetches PrefetchCount number of messages. Setting the value to zero turns prefetch off. Defaults to 0.

(Inherited from IReceiverClient)
ReceiveMode

Gets the ReceiveMode of the current receiver.

(Inherited from IReceiverClient)
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)
SessionId

Gets the SessionId.

Methods

AbandonAsync(String, IDictionary<String,Object>)

Abandons a Message using a lock token. This will make the message available again for processing.

(Inherited from IReceiverClient)
CloseAsync()

Closes the Client. Closes the connections opened by it.

(Inherited from IClientEntity)
CompleteAsync(IEnumerable<String>)

Completes a series of Message using a list of lock tokens. This will delete the message from the service.

(Inherited from IMessageReceiver)
CompleteAsync(String)

Completes a Message using its lock token. This will delete the message from the queue.

(Inherited from IReceiverClient)
DeadLetterAsync(String, IDictionary<String,Object>)

Moves a message to the deadletter sub-queue.

(Inherited from IReceiverClient)
DeadLetterAsync(String, String, String)

Moves a message to the deadletter sub-queue.

(Inherited from IReceiverClient)
DeferAsync(String, IDictionary<String,Object>)

Indicates that the receiver wants to defer the processing for the message.

(Inherited from IMessageReceiver)
GetStateAsync()

Gets the session state.

PeekAsync()

Fetches the next active message without changing the state of the receiver or the message source.

(Inherited from IMessageReceiver)
PeekAsync(Int32)

Fetches the next batch of active messages without changing the state of the receiver or the message source.

(Inherited from IMessageReceiver)
PeekBySequenceNumberAsync(Int64, Int32)

Peeks a batch of messages.

(Inherited from IMessageReceiver)
PeekBySequenceNumberAsync(Int64)

Asynchronously reads the next message without changing the state of the receiver or the message source.

(Inherited from IMessageReceiver)
ReceiveAsync()

Receive a message from the entity defined by Path using ReceiveMode mode.

(Inherited from IMessageReceiver)
ReceiveAsync(Int32, TimeSpan)

Receives a maximum of maxMessageCount messages from the entity defined by Path using ReceiveMode mode.

(Inherited from IMessageReceiver)
ReceiveAsync(Int32)

Receives a maximum of maxMessageCount messages from the entity defined by Path using ReceiveMode mode.

(Inherited from IMessageReceiver)
ReceiveAsync(TimeSpan)

Receive a message from the entity defined by Path using ReceiveMode mode.

(Inherited from IMessageReceiver)
ReceiveDeferredMessageAsync(IEnumerable<Int64>)

Receives a IList<T> of deferred messages identified by sequenceNumbers.

(Inherited from IMessageReceiver)
ReceiveDeferredMessageAsync(Int64)

Receives a specific deferred message identified by sequenceNumber.

(Inherited from IMessageReceiver)
RegisterMessageHandler(Func<Message,CancellationToken,Task>, Func<ExceptionReceivedEventArgs,Task>)

Receive messages continuously from the entity. Registers a message handler and begins a new thread to receive messages. This handler(Func<T1,T2,TResult>) is awaited on every time a new message is received by the receiver.

(Inherited from IReceiverClient)
RegisterMessageHandler(Func<Message,CancellationToken,Task>, MessageHandlerOptions)

Receive messages continuously from the entity. Registers a message handler and begins a new thread to receive messages. This handler(Func<T1,T2,TResult>) is awaited on every time a new message is received by the receiver.

(Inherited from IReceiverClient)
RegisterPlugin(ServiceBusPlugin)

Registers a ServiceBusPlugin to be used with this client.

(Inherited from IClientEntity)
RenewLockAsync(Message)

Renews the lock on the message. The lock will be renewed based on the setting specified on the queue.

(Inherited from IMessageReceiver)
RenewLockAsync(String)

Renews the lock on the message. The lock will be renewed based on the setting specified on the queue. New lock token expiry date and time in UTC format.

(Inherited from IMessageReceiver)
RenewSessionLockAsync()

Renews the lock on the session specified by the SessionId. The lock will be renewed based on the setting specified on the entity.

SetStateAsync(Byte[])

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

UnregisterMessageHandlerAsync(TimeSpan)

Unregister message handler from the receiver if there is an active message handler registered. This operation waits for the completion of inflight receive and message handling operations to finish and unregisters future receives on the message handler which previously registered.

(Inherited from IReceiverClient)
UnregisterPlugin(String)

Unregisters a ServiceBusPlugin.

(Inherited from IClientEntity)

Applies to