public static IServiceCollection AddRabbitMqMessaging(
            this IServiceCollection services,
            RabbitMqConfiguration configuration,
            params Action <IServiceCollectionBusConfigurator>[] addConsumerActions)
        {
            return(services
                   .AddScoped(typeof(INotificationHandler <>), typeof(DomainEventHandler <>))
                   .AddMassTransit(x =>
            {
                foreach (var addConsumerAction in addConsumerActions)
                {
                    addConsumerAction(x);
                }

                x.SetKebabCaseEndpointNameFormatter();
                x.UsingRabbitMq((context, cfg) =>
                {
                    cfg.Host(configuration.GetUri(), h =>
                    {
                        h.Username(configuration.Username);
                        h.Password(configuration.Password);
                    });

                    cfg.ConfigureEndpoints(context);
                });
            })
                   .AddMassTransitHostedService());
        }