Class BrokerOptionsBuilder
Exposes the methods to configure the connection with the message broker(s) and add the necessary services to the IServiceCollection.
Inherited Members
Namespace: Silverback.Messaging.Configuration
Assembly: Silverback.Integration.dll
Syntax
public sealed class BrokerOptionsBuilder
Constructors
BrokerOptionsBuilder(SilverbackBuilder)
Initializes a new instance of the BrokerOptionsBuilder class.
Declaration
public BrokerOptionsBuilder(SilverbackBuilder silverbackBuilder)
Parameters
| Type | Name | Description |
|---|---|---|
| SilverbackBuilder | silverbackBuilder | The SilverbackBuilder that references the IServiceCollection to add the services to. |
Properties
SilverbackBuilder
Gets the SilverbackBuilder that references the IServiceCollection to add the services to.
Declaration
public SilverbackBuilder SilverbackBuilder { get; }
Property Value
| Type | Description |
|---|---|
| SilverbackBuilder |
Methods
AddOutboxWorker(OutboxWorkerSettings)
Adds an OutboxWorker to publish the messages stored in the outbox to the configured broker.
Declaration
public BrokerOptionsBuilder AddOutboxWorker(OutboxWorkerSettings settings)
Parameters
| Type | Name | Description |
|---|---|---|
| OutboxWorkerSettings | settings | The worker settings. |
Returns
| Type | Description |
|---|---|
| BrokerOptionsBuilder | The BrokerOptionsBuilder so that additional calls can be chained. |
AddOutboxWorker(Action<OutboxWorkerSettingsBuilder>)
Adds an OutboxWorker to publish the messages stored in the outbox to the configured broker.
Declaration
public BrokerOptionsBuilder AddOutboxWorker(Action<OutboxWorkerSettingsBuilder> settingsBuilderAction)
Parameters
| Type | Name | Description |
|---|---|---|
| Action<OutboxWorkerSettingsBuilder> | settingsBuilderAction | An Action<T> that takes the OutboxWorkerSettingsBuilder and configures it. |
Returns
| Type | Description |
|---|---|
| BrokerOptionsBuilder | The BrokerOptionsBuilder so that additional calls can be chained. |
ConnectAfterStartup()
Specifies that the broker clients have to be connected after the application is successfully started.
Declaration
public BrokerOptionsBuilder ConnectAfterStartup()
Returns
| Type | Description |
|---|---|
| BrokerOptionsBuilder | The BrokerOptionsBuilder so that additional calls can be chained. |
ConnectAtStartup()
Specifies that the broker clients have to be connected during the application startup.
Declaration
public BrokerOptionsBuilder ConnectAtStartup()
Returns
| Type | Description |
|---|---|
| BrokerOptionsBuilder | The BrokerOptionsBuilder so that additional calls can be chained. |
DisableRetryOnConnectionFailure()
Specifies that no retry must be performed if an exception is thrown when trying to connect.
Declaration
public BrokerOptionsBuilder DisableRetryOnConnectionFailure()
Returns
| Type | Description |
|---|---|
| BrokerOptionsBuilder | The BrokerOptionsBuilder so that additional calls can be chained. |
ManuallyConnect()
Specifies that the broker clients must be initialized but not connected. They can be manually connected later.
Declaration
public BrokerOptionsBuilder ManuallyConnect()
Returns
| Type | Description |
|---|---|
| BrokerOptionsBuilder | The BrokerOptionsBuilder so that additional calls can be chained. |
RetryOnConnectionFailure(TimeSpan?)
Specifies that a retry must be performed if an exception is thrown when trying to connect.
Declaration
public BrokerOptionsBuilder RetryOnConnectionFailure(TimeSpan? retryInterval = null)
Parameters
| Type | Name | Description |
|---|---|---|
| TimeSpan? | retryInterval | The interval between the connection retries. The default is 5 minutes. |
Returns
| Type | Description |
|---|---|
| BrokerOptionsBuilder | The BrokerOptionsBuilder so that additional calls can be chained. |
WithConnectionOptions(BrokerClientConnectionOptions)
Specifies the BrokerClientConnectionOptions.
Declaration
public BrokerOptionsBuilder WithConnectionOptions(BrokerClientConnectionOptions clientConnectionOptions)
Parameters
| Type | Name | Description |
|---|---|---|
| BrokerClientConnectionOptions | clientConnectionOptions | The BrokerClientConnectionOptions to apply. |
Returns
| Type | Description |
|---|---|
| BrokerOptionsBuilder | The BrokerOptionsBuilder so that additional calls can be chained. |