using Microsoft.Extensions.DependencyInjection;
using Svrnty.CQRS.Events.Abstractions;
namespace Svrnty.CQRS.Events.RabbitMQ;
///
/// Extension methods for registering RabbitMQ domain event publishing.
///
public static class ServiceCollectionExtensions
{
///
/// Adds RabbitMQ domain event publishing to the service collection.
///
/// The service collection.
/// Optional configuration action for RabbitMQ options.
/// The service collection for chaining.
public static IServiceCollection AddRabbitMqDomainEvents(
this IServiceCollection services,
Action? configure = null)
{
if (configure != null)
{
services.Configure(configure);
}
services.AddSingleton();
return services;
}
}