ServiceBusSessionProcessor.UpdateConcurrency(Int32, Int32) Method

Definition

Updates the concurrency for the processor. This method can be used to dynamically change the concurrency of a running processor.

public void UpdateConcurrency(int maxConcurrentSessions, int maxConcurrentCallsPerSession);
member this.UpdateConcurrency : int * int -> unit
Public Sub UpdateConcurrency (maxConcurrentSessions As Integer, maxConcurrentCallsPerSession As Integer)

Parameters

maxConcurrentSessions
Int32

The new max concurrent sessions value. This will be reflected in the MaxConcurrentSessions property.

maxConcurrentCallsPerSession
Int32

The new max concurrent calls per session value. This will be reflected in the MaxConcurrentCallsPerSession.

Remarks

When reducing concurrency, cancellation will be requested for in-progress message handlers that exceed the new concurrency limit via their associated CancellationToken. There is no guarantee as to which handlers will be cancelled. Handlers should observe the cancellation token passed via CancellationToken and handle cancellation gracefully to avoid incomplete processing. The cancellation is cooperative; handlers that do not observe the token will continue to run until they complete. When increasing concurrency, the change takes effect immediately by allowing additional concurrent message handlers.

Applies to