Show / Hide Table of Contents

Class ServiceBusOptions

Configuration options for the ServiceBus extension.

Inheritance
System.Object
ServiceBusOptions
Namespace: System.Dynamic.ExpandoObject
Assembly: Microsoft.Azure.WebJobs.Extensions.ServiceBus.dll
Syntax
public class ServiceBusOptions : Microsoft.Azure.WebJobs.Hosting.IOptionsFormatter

Constructors

ServiceBusOptions()

Constructs a new instance.

Declaration
public ServiceBusOptions ();

Properties

AutoCompleteMessages

Gets or sets whether to automatically complete messages after successful execution of the function. The default value is true.

Declaration
public bool AutoCompleteMessages { get; set; }
Property Value
System.Boolean

ClientRetryOptions

The set of options to use for determining whether a failed operation should be retried and, if so, the amount of time to wait between retry attempts. These options also control the amount of time allowed for receiving messages and other interactions with the Service Bus service.

Declaration
public Azure.Messaging.ServiceBus.ServiceBusRetryOptions ClientRetryOptions { get; set; }
Property Value
Azure.Messaging.ServiceBus.ServiceBusRetryOptions

EnableCrossEntityTransactions

Gets or sets a flag that indicates whether or not transactions may span multiple Service Bus entities.

Declaration
public bool EnableCrossEntityTransactions { get; set; }
Property Value
System.Boolean

JsonSerializerSettings

Gets or sets the JSON serialization settings to use when binding to POCOs.

Declaration
public Newtonsoft.Json.JsonSerializerSettings JsonSerializerSettings { get; set; }
Property Value
Newtonsoft.Json.JsonSerializerSettings

MaxAutoLockRenewalDuration

Gets or sets the maximum duration within which the lock will be renewed automatically. This value should be greater than the longest message lock duration; for example, the LockDuration Property. The default value is 5 minutes. This does not apply for functions that receive a batch of messages. To specify an infinite duration, use System.Threading.Timeout.InfiniteTimeSpan or -00:00:00.0010000 if specifying via host.json.

Declaration
public TimeSpan MaxAutoLockRenewalDuration { get; set; }
Property Value
System.TimeSpan

MaxBatchWaitTime

Gets or sets the maximum time that the trigger should wait to fill a batch before invoking the function. This is only considered when MinMessageBatchSize is set to larger than 1 and is otherwise unused. If less than MinMessageBatchSize messages were available before the wait time elapses, the function will be invoked with a partial batch. This value should be no longer then 50% of the entity message lock duration. Therefore, the maximum allowed value is 2 minutes and 30 seconds. Otherwise, you may get lock exceptions when messages are pulled from the cache. The default value is 30 seconds.

Declaration
public TimeSpan MaxBatchWaitTime { get; set; }
Property Value
System.TimeSpan

MaxConcurrentCalls

Gets or sets the maximum number of messages that can be processed concurrently by a function. This setting does not apply for functions that receive a batch of messages. The default is 16 times the return value of Microsoft.Azure.WebJobs.ServiceBus.Utility.GetProcessorCount. When Microsoft.Azure.WebJobs.Host.Scale.ConcurrencyOptions.DynamicConcurrencyEnabled is true, this value will be ignored, and concurrency will be increased/decreased dynamically.

Declaration
public int MaxConcurrentCalls { get; set; }
Property Value
System.Int32

MaxConcurrentCallsPerSession

Gets or sets the maximum number of concurrent calls to the function per session. Thus the total number of concurrent calls will be equal to MaxConcurrentSessions * MaxConcurrentCallsPerSession. The default value is 1. This applies only to functions that set IsSessionsEnabled to true. This does not apply for functions that receive a batch of messages. When Microsoft.Azure.WebJobs.Host.Scale.ConcurrencyOptions.DynamicConcurrencyEnabled is true, this value will be ignored, and concurrency will be increased/decreased dynamically.

Declaration
public int MaxConcurrentCallsPerSession { get; set; }
Property Value
System.Int32

The maximum number of concurrent calls to the message handler for each session that is being processed.

Exceptions
System.ArgumentOutOfRangeException

A value that is not positive is attempted to be set for the property.

MaxConcurrentSessions

Gets or sets the maximum number of sessions that can be processed concurrently by a function. The default value is 8. This applies only to functions that set IsSessionsEnabled to true. This does not apply for functions that receive a batch of messages. When Microsoft.Azure.WebJobs.Host.Scale.ConcurrencyOptions.DynamicConcurrencyEnabled is true, this value will be ignored, and concurrency will be increased/decreased dynamically.

Declaration
public int MaxConcurrentSessions { get; set; }
Property Value
System.Int32

MaxMessageBatchSize

Gets or sets the maximum number of messages that will be passed to each function call. This only applies for functions that receive a batch of messages. The default value is 1000.

Declaration
public int MaxMessageBatchSize { get; set; }
Property Value
System.Int32

MinMessageBatchSize

Gets or sets the minimum number of messages desired for a batch. This setting applies only to functions that receive multiple messages. This value must be less than MaxMessageBatchSize and is used in conjunction with MaxBatchWaitTime. If MaxBatchWaitTime passes and less than MinMessageBatchSize has been received, the function will be invoked with a partial batch. Default 1.

Declaration
public int MinMessageBatchSize { get; set; }
Property Value
System.Int32

Remarks

The minimum size is not a strict guarantee, as a partial batch will be dispatched if a full batch cannot be prepared before the MaxBatchWaitTime has elapsed.

PrefetchCount

Gets or sets the PrefetchCount that will be used when receiving messages. The default value is 0.

Declaration
public int PrefetchCount { get; set; }
Property Value
System.Int32

ProcessErrorAsync

Gets or sets an optional error handler that will be invoked if an exception occurs while attempting to process a message. This does not apply for functions that receive a batch of messages.

Declaration
public Func<Azure.Messaging.ServiceBus.ProcessErrorEventArgs,System.Threading.Tasks.Task> ProcessErrorAsync { get; set; }
Property Value
System.Func<Azure.Messaging.ServiceBus.ProcessErrorEventArgs,System.Threading.Tasks.Task>

SessionClosingAsync

Optional handler that can be set to be notified when a session is about to be closed for processing.

Declaration
public Func<Azure.Messaging.ServiceBus.ProcessSessionEventArgs,System.Threading.Tasks.Task> SessionClosingAsync { get; set; }
Property Value
System.Func<Azure.Messaging.ServiceBus.ProcessSessionEventArgs,System.Threading.Tasks.Task>

SessionIdleTimeout

Gets or sets the maximum amount of time to wait for a message to be received for the currently active session. After this time has elapsed, the processor will close the session and attempt to process another session. If not specified, the Azure.Messaging.ServiceBus.ServiceBusRetryOptions.TryTimeout will be used.

Declaration
public Nullable<TimeSpan> SessionIdleTimeout { get; set; }
Property Value
System.Nullable<System.TimeSpan>

SessionInitializingAsync

Optional handler that can be set to be notified when a new session is about to be processed.

Declaration
public Func<Azure.Messaging.ServiceBus.ProcessSessionEventArgs,System.Threading.Tasks.Task> SessionInitializingAsync { get; set; }
Property Value
System.Func<Azure.Messaging.ServiceBus.ProcessSessionEventArgs,System.Threading.Tasks.Task>

TransportType

The type of protocol and transport that will be used for communicating with the Service Bus service.

Declaration
public Azure.Messaging.ServiceBus.ServiceBusTransportType TransportType { get; set; }
Property Value
Azure.Messaging.ServiceBus.ServiceBusTransportType

WebProxy

The proxy to use for communication over web sockets.

Declaration
public System.Net.IWebProxy WebProxy { get; set; }
Property Value
System.Net.IWebProxy

Remarks

A proxy cannot be used for communication over TCP; if web sockets are not in

use, specifying a proxy is an invalid option.

Explicit Interface Implementations

IOptionsFormatter.Format()

Formats the options as JSON objects for display.

Declaration
string IOptionsFormatter.Format ();
Returns
System.String

Options formatted as JSON.

Back to top Azure SDK for .NET