Class OutboxWorkerSettingsBuilder
- Namespace
- Silverback.Messaging.Configuration
- Assembly
- Silverback.Integration.dll
Builds the OutboxWorkerSettings.
public class OutboxWorkerSettingsBuilder
- Inheritance
-
OutboxWorkerSettingsBuilder
- Inherited Members
Constructors
OutboxWorkerSettingsBuilder()
public OutboxWorkerSettingsBuilder()
Methods
Build()
Builds OutboxWorkerSettings.
public OutboxWorkerSettings Build()
Returns
DisableMessageOrderEnforcement()
Don't strictly enforce the message ordering, meaning that a failure in the produce of a message will cause it to be temporary skipped to try to produce the next message in the queue.
public OutboxWorkerSettingsBuilder DisableMessageOrderEnforcement()
Returns
- OutboxWorkerSettingsBuilder
The OutboxWorkerSettingsBuilder so that additional calls can be chained.
EnforceMessageOrder()
Preserve the message ordering, meaning that a failure in the produce of a message will block the whole outbox. This is the default.
public OutboxWorkerSettingsBuilder EnforceMessageOrder()
Returns
- OutboxWorkerSettingsBuilder
The OutboxWorkerSettingsBuilder so that additional calls can be chained.
ProcessOutbox(Func<OutboxSettingsBuilder, IOutboxSettingsImplementationBuilder>)
Specifies the OutboxSettings to be used by the outbox worker.
public OutboxWorkerSettingsBuilder ProcessOutbox(Func<OutboxSettingsBuilder, IOutboxSettingsImplementationBuilder> outboxSettingsBuilderFunc)
Parameters
outboxSettingsBuilderFuncFunc<OutboxSettingsBuilder, IOutboxSettingsImplementationBuilder>A Func<TResult> that takes the OutboxSettingsBuilder and configures it.
Returns
- OutboxWorkerSettingsBuilder
The OutboxWorkerSettingsBuilder so that additional calls can be chained.
WithBatchSize(int)
Sets the number of messages to be retrieved from the outbox and processed at once. The default is 1000.
public OutboxWorkerSettingsBuilder WithBatchSize(int batchSize)
Parameters
batchSizeintThe number of messages to be processed at once.
Returns
- OutboxWorkerSettingsBuilder
The OutboxWorkerSettingsBuilder so that additional calls can be chained.
WithDistributedLock(Func<DistributedLockSettingsBuilder, IDistributedLockSettingsImplementationBuilder>)
Explicitly configure the settings for the optional IDistributedLock to be used to ensure that only one instance is running at the same time. By default it will be automatically inferred from the outbox settings.
public OutboxWorkerSettingsBuilder WithDistributedLock(Func<DistributedLockSettingsBuilder, IDistributedLockSettingsImplementationBuilder> lockSettingsBuilderFunc)
Parameters
lockSettingsBuilderFuncFunc<DistributedLockSettingsBuilder, IDistributedLockSettingsImplementationBuilder>A Func<TResult> that takes the DistributedLockSettingsBuilder and configures it.
Returns
- OutboxWorkerSettingsBuilder
The OutboxWorkerSettingsBuilder so that additional calls can be chained.
WithExponentialRetryDelay(TimeSpan, double, TimeSpan?)
Specifies an initial delay before the first retry and a factor to be applied to the delay at each retry.
public OutboxWorkerSettingsBuilder WithExponentialRetryDelay(TimeSpan initialDelay, double delayFactor, TimeSpan? maxDelay = null)
Parameters
initialDelayTimeSpanThe initial delay before the first retry.
delayFactordoubleThe factor to be applied at each retry.
maxDelayTimeSpan?The maximum delay to be applied.
Returns
- OutboxWorkerSettingsBuilder
The OutboxWorkerSettingsBuilder so that additional calls can be chained.
WithIncrementalRetryDelay(TimeSpan, TimeSpan, TimeSpan?)
Specifies an initial delay before the first retry and an increment to be added at each subsequent retry.
public OutboxWorkerSettingsBuilder WithIncrementalRetryDelay(TimeSpan initialDelay, TimeSpan delayIncrement, TimeSpan? maxDelay = null)
Parameters
initialDelayTimeSpanThe initial delay before the first retry.
delayIncrementTimeSpanThe increment to be added at each subsequent retry.
maxDelayTimeSpan?The maximum delay to be applied.
Returns
- OutboxWorkerSettingsBuilder
The OutboxWorkerSettingsBuilder so that additional calls can be chained.
WithInterval(TimeSpan)
Sets the interval between the outbox worker executions. The default is 500 milliseconds.
public OutboxWorkerSettingsBuilder WithInterval(TimeSpan interval)
Parameters
intervalTimeSpanThe interval between the outbox worker executions.
Returns
- OutboxWorkerSettingsBuilder
The OutboxWorkerSettingsBuilder so that additional calls can be chained.
WithoutDistributedLock()
Explicitly disable the distributed lock.
public OutboxWorkerSettingsBuilder WithoutDistributedLock()
Returns
- OutboxWorkerSettingsBuilder
The OutboxWorkerSettingsBuilder so that additional calls can be chained.