Class MessagingServiceCollectionExtensions
- Namespace
- Microsoft.Extensions.DependencyInjection
- Assembly
- Stratara.Outbox.RabbitMQ.dll
Service-collection extensions for the Stratara messaging stack.
public static class MessagingServiceCollectionExtensions
- Inheritance
-
MessagingServiceCollectionExtensions
- Inherited Members
Methods
AddMessaging(IHostApplicationBuilder)
Registers the messaging infrastructure: IMessageBus backed by
Stratara.Outbox.RabbitMQ.Messaging.RabbitMqBus, the IMessagingIdentifier service, and binds
MessagingOptions from the Messaging configuration section.
public static IHostApplicationBuilder AddMessaging(this IHostApplicationBuilder builder)
Parameters
builderIHostApplicationBuilderThe host-application builder.
Returns
- IHostApplicationBuilder
The same builder, for chaining.
Examples
Bind the RabbitMQ bus from configuration. The composite worker DI extensions
(AddBackendServices, AddCommandWorkerServices, …) already call
this internally; only call it directly when composing a custom worker shape.
// appsettings.json:
// "Messaging": { "Host": "rabbitmq", "VirtualHost": "/", "Username": "...", "Password": "..." }
var builder = Host.CreateApplicationBuilder(args);
builder.AddMessaging();