Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/laget-se/masstransit.extensions.module

Autofac inspired `Module` structure for `MassTransit` that is used by calling `.RegisterModule<T>()` in `.AddMassTransit`.
https://github.com/laget-se/masstransit.extensions.module

nuget

Last synced: 22 days ago
JSON representation

Autofac inspired `Module` structure for `MassTransit` that is used by calling `.RegisterModule<T>()` in `.AddMassTransit`.

Awesome Lists containing this project

README

        

# MassTransit.Extensions.Module
Autofac inspired `Module` structure for `MassTransit` that is used by calling `.RegisterModule()` in `.AddMassTransit`.

## Usage
### HostBuilder
```c#
public class Program
{
private static async Task Main()
{
await Host.CreateDefaultBuilder()
.ConfigureContainer((context, builder) =>
{
})
.ConfigureServices((context, services) =>
{
services.AddOptions().Configure(options =>
{
options.ConnectionString = context.Configuration.GetValue("AzureServiceBusTransportOptions:ConnectionString");
});
services.AddMassTransit(x =>
{
x.RegisterModule();

x.SetKebabCaseEndpointNameFormatter();
x.UsingAzureServiceBus((context, cfg) =>
{
cfg.ConfigureEndpoints(context);
});
});
})
.Build()
.RunAsync();
}
}
```

### Module
```c#
public class OrderModule : Module
{
public override void Configure(IBusRegistrationConfigurator configurator)
{
configurator.AddConsumer().Endpoint(config => config.InstanceId = "Order.Service");
configurator.AddConsumer().Endpoint(config => config.InstanceId = "Order.Service");
configurator.AddConsumer().Endpoint(config => config.InstanceId = "Order.Service");
}
}
```