Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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`.
- Host: GitHub
- URL: https://github.com/laget-se/masstransit.extensions.module
- Owner: laget-se
- Created: 2023-10-13T12:43:45.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-04-05T07:31:00.000Z (9 months ago)
- Last Synced: 2024-04-05T08:36:02.554Z (9 months ago)
- Topics: nuget
- Language: C#
- Homepage:
- Size: 36.1 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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");
}
}
```