Skip to content

Rebus.Configuration

Frank Wagner edited this page Jan 11, 2023 · 3 revisions

Why?

To configure rebus you normally have to use the Configure methods provided by Rebus. For example:

Configure.With(someContainerAdapter)
    .Logging(l => l.Serilog())
    .Transport(t => t.UseMsmq("myInputQueue"))
    .Routing(r => r.TypeBased().MapAssemblyOf<SomeMessageType>("anotherInputQueue"))
    .Start();

With Rebus.Configuration you can now configure rebus like this:

Configure.With(someContainerAdapter)
    .Logging(l => l.Serilog())
    .Transport(serviceProvider.GetRequiredService<IRebusTransportConfigurer>())
    .Routing(r => r.TypeBased().MapAssemblyOf<SomeMessageType>("anotherInputQueue"))
    .Start();

So transport configuration is now injected via dependency injection.

Selectors

Rebus.Configuration.Selectors makes it simple to configure rebus via application configuration. To use selectors you register your selectors as implementation for transport configurer or another configurer:

services.AddSingleton<IRebusTransportConfigurer, DefaultTransportSelector>()

The transport selector will choose the rebus transport from application configuration entry bus:type. Default selector supports build in transports only - allowed values for type are 'inmemory' or 'filesystem'.

Selector configuration sections

Selectors are grouped in 3 configuration sectors:

  • bus
    transport selectors

  • store
    subscription, saga and timeout storage selectors

  • databus
    databus selectors

Please note:
Some transports register their own implementation for subscription storage or timeouts. In that case you could create your own version of a selector by inherits from a existing selector and overwriting the configuration name.

Clone this wiki locally