Table of Contents

Class BatchOptions

Namespace
MassTransit
Assembly
MassTransit.Abstractions.dll

Batch options are applied to a Batch<T> consumer to configure the size and time limits for each batch.

public class BatchOptions : IOptions, IConfigureReceiveEndpoint, ISpecification
Inheritance
BatchOptions
Implements
Inherited Members
Extension Methods

Constructors

BatchOptions()

public BatchOptions()

Properties

ConcurrencyLimit

The number of batches which can be executed concurrently

public int ConcurrencyLimit { get; set; }

Property Value

int

GroupKeyProvider

The property to group by

public object? GroupKeyProvider { get; }

Property Value

object

MessageLimit

The maximum number of messages in a single batch

public int MessageLimit { get; set; }

Property Value

int

TimeLimit

The maximum time to wait before delivering a partial batch

public TimeSpan TimeLimit { get; set; }

Property Value

TimeSpan

TimeLimitStart

The starting point for the TimeLimit

public BatchTimeLimitStart TimeLimitStart { get; set; }

Property Value

BatchTimeLimitStart

Methods

Configure(string, IReceiveEndpointConfigurator)

Configure the receive endpoint (called prior to any consumer, saga, or activity configuration)

public void Configure(string name, IReceiveEndpointConfigurator configurator)

Parameters

name string
configurator IReceiveEndpointConfigurator

GroupBy<T, TProperty>(Func<ConsumeContext<T>, TProperty?>)

public BatchOptions GroupBy<T, TProperty>(Func<ConsumeContext<T>, TProperty?> provider) where T : class where TProperty : struct

Parameters

provider Func<ConsumeContext<T>, TProperty?>

Returns

BatchOptions

Type Parameters

T
TProperty

GroupBy<T, TProperty>(Func<ConsumeContext<T>, TProperty>)

public BatchOptions GroupBy<T, TProperty>(Func<ConsumeContext<T>, TProperty> provider) where T : class where TProperty : class

Parameters

provider Func<ConsumeContext<T>, TProperty>

Returns

BatchOptions

Type Parameters

T
TProperty

SetConcurrencyLimit(int)

Sets the number of batches which can be executed concurrently

public BatchOptions SetConcurrencyLimit(int limit)

Parameters

limit int

The message limit

Returns

BatchOptions

SetMessageLimit(int)

Sets the maximum number of messages in a single batch

public BatchOptions SetMessageLimit(int limit)

Parameters

limit int

The message limit

Returns

BatchOptions

SetTimeLimit(int?, int?, int?, int?, int?)

Sets the maximum time to wait before delivering a partial batch

public BatchOptions SetTimeLimit(int? ms = null, int? s = null, int? m = null, int? h = null, int? d = null)

Parameters

ms int?
s int?
m int?
h int?
d int?

Returns

BatchOptions

SetTimeLimit(TimeSpan)

Sets the maximum time to wait before delivering a partial batch

public BatchOptions SetTimeLimit(TimeSpan limit)

Parameters

limit TimeSpan

The message limit

Returns

BatchOptions

SetTimeLimitStart(BatchTimeLimitStart)

Sets the starting point for the TimeLimit

public BatchOptions SetTimeLimitStart(BatchTimeLimitStart timeLimitStart)

Parameters

timeLimitStart BatchTimeLimitStart

The starting point

Returns

BatchOptions

Validate()

Validate the specification, ensuring that a successful build will occur.

public IEnumerable<ValidationResult> Validate()

Returns

IEnumerable<ValidationResult>