IQueueClient.RegisterSessionHandler Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
RegisterSessionHandler(Func<IMessageSession,Message,CancellationToken,Task>, SessionHandlerOptions) |
Receive session messages continuously from the queue. Registers a message handler and begins a new thread to receive session-messages. This handler(Func<T1,T2,T3,TResult>) is awaited on every time a new message is received by the queue client. |
RegisterSessionHandler(Func<IMessageSession,Message,CancellationToken,Task>, Func<ExceptionReceivedEventArgs,Task>) |
Receive session messages continuously from the queue. Registers a message handler and begins a new thread to receive session-messages. This handler(Func<T1,T2,T3,TResult>) is awaited on every time a new message is received by the queue client. |
RegisterSessionHandler(Func<IMessageSession,Message,CancellationToken,Task>, SessionHandlerOptions)
Receive session messages continuously from the queue. Registers a message handler and begins a new thread to receive session-messages. This handler(Func<T1,T2,T3,TResult>) is awaited on every time a new message is received by the queue client.
public void RegisterSessionHandler (Func<Microsoft.Azure.ServiceBus.IMessageSession,Microsoft.Azure.ServiceBus.Message,System.Threading.CancellationToken,System.Threading.Tasks.Task> handler, Microsoft.Azure.ServiceBus.SessionHandlerOptions sessionHandlerOptions);
abstract member RegisterSessionHandler : Func<Microsoft.Azure.ServiceBus.IMessageSession, Microsoft.Azure.ServiceBus.Message, System.Threading.CancellationToken, System.Threading.Tasks.Task> * Microsoft.Azure.ServiceBus.SessionHandlerOptions -> unit
Public Sub RegisterSessionHandler (handler As Func(Of IMessageSession, Message, CancellationToken, Task), sessionHandlerOptions As SessionHandlerOptions)
Parameters
- handler
- Func<IMessageSession,Message,CancellationToken,Task>
A Func<T1,T2,T3,TResult> that processes messages. IMessageSession contains the session information, and must be used to perform Complete/Abandon/Deadletter or other such operations on the Message
- sessionHandlerOptions
- SessionHandlerOptions
Options used to configure the settings of the session pump.
Remarks
Enable prefetch to speed up the receive rate.
Applies to
RegisterSessionHandler(Func<IMessageSession,Message,CancellationToken,Task>, Func<ExceptionReceivedEventArgs,Task>)
Receive session messages continuously from the queue. Registers a message handler and begins a new thread to receive session-messages. This handler(Func<T1,T2,T3,TResult>) is awaited on every time a new message is received by the queue client.
public void RegisterSessionHandler (Func<Microsoft.Azure.ServiceBus.IMessageSession,Microsoft.Azure.ServiceBus.Message,System.Threading.CancellationToken,System.Threading.Tasks.Task> handler, Func<Microsoft.Azure.ServiceBus.ExceptionReceivedEventArgs,System.Threading.Tasks.Task> exceptionReceivedHandler);
abstract member RegisterSessionHandler : Func<Microsoft.Azure.ServiceBus.IMessageSession, Microsoft.Azure.ServiceBus.Message, System.Threading.CancellationToken, System.Threading.Tasks.Task> * Func<Microsoft.Azure.ServiceBus.ExceptionReceivedEventArgs, System.Threading.Tasks.Task> -> unit
Public Sub RegisterSessionHandler (handler As Func(Of IMessageSession, Message, CancellationToken, Task), exceptionReceivedHandler As Func(Of ExceptionReceivedEventArgs, Task))
Parameters
- handler
- Func<IMessageSession,Message,CancellationToken,Task>
A Func<T1,T2,T3,TResult> that processes messages. IMessageSession contains the session information, and must be used to perform Complete/Abandon/Deadletter or other such operations on the Message
- exceptionReceivedHandler
- Func<ExceptionReceivedEventArgs,Task>
A Func<T,TResult> that is invoked during exceptions. ExceptionReceivedEventArgs contains contextual information regarding the exception.
Remarks
Enable prefetch to speed up the receive rate. Use RegisterSessionHandler(Func<IMessageSession,Message,CancellationToken,Task>, SessionHandlerOptions) to configure the settings of the pump.