Table of Contents

Class BrokerOptionsBuilderOutboxTestingExtensions

Namespace
Silverback.Messaging.Configuration
Assembly
Silverback.Integration.Testing.dll

Adds the UseManualOutboxWorker and BypassOutbox methods to the BrokerOptionsBuilder.

public static class BrokerOptionsBuilderOutboxTestingExtensions
Inheritance
BrokerOptionsBuilderOutboxTestingExtensions
Inherited Members

Methods

BypassOutbox(BrokerOptionsBuilder)

Replaces the outbox writer with one that produces the messages to the message broker right away, instead of storing them to the outbox. No outbox worker is needed and the outbox remains empty.

public static BrokerOptionsBuilder BypassOutbox(this BrokerOptionsBuilder builder)

Parameters

builder BrokerOptionsBuilder

The BrokerOptionsBuilder.

Returns

BrokerOptionsBuilder

The BrokerOptionsBuilder so that additional calls can be chained.

Remarks

The database transaction (if any) is ignored and the produce errors are thrown to the publisher.

The outbox reader is replaced as well, with one that is always empty, so that no outbox storage is required.

This method must be called inside the WithConnectionToMessageBroker callback, after any other method overriding the outbox (e.g. UseInMemoryOutbox), since the last override wins.

UseManualOutboxWorker(BrokerOptionsBuilder)

Prevents the registered outbox workers from processing the outbox on their own. The tests are in control and can trigger the processing calling ProcessAsync(CancellationToken) (via Outbox).

public static BrokerOptionsBuilder UseManualOutboxWorker(this BrokerOptionsBuilder builder)

Parameters

builder BrokerOptionsBuilder

The BrokerOptionsBuilder.

Returns

BrokerOptionsBuilder

The BrokerOptionsBuilder so that additional calls can be chained.

Remarks

The workers are suspended like with PauseWorkerAsync(CancellationToken), so ResumeWorker() switches them back to the regular processing.