Exemplo n.º 1
0
 public RabbitMqBackgroundEventHandler(IBusClient busClient, IServiceProvider serviceProvider,
                                       ILogger <RabbitMqBackgroundEventHandler <TEvent> > logger, ElwarkRabbitConfiguration configuration)
 {
     _busClient       = busClient ?? throw new ArgumentNullException(nameof(busClient));
     _serviceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider));
     _logger          = logger ?? throw new ArgumentNullException(nameof(logger));
     _configuration   = configuration ?? throw new ArgumentNullException(nameof(configuration));
 }
Exemplo n.º 2
0
        public static IElwarkRabbitMqBuilder AddElwarkRabbitMq(this IServiceCollection services,
                                                               ElwarkRabbitConfiguration configuration)
        {
            var builder = new ElwarkRabbitMqBuilder(services);

            builder.Services.AddRawRabbit(new RawRabbitOptions
            {
                ClientConfiguration = configuration,
                Plugins             = plugins => plugins
                                      .UseRetryLater()
                                      .UseContextForwarding()
                                      .UseMessageContext <ElwarkMessageContext>()
            });

            builder.Services.AddSingleton(configuration);
            builder.Services.AddSingleton <IIntegrationEventPublisher, RabbitMqEventPublisher>();

            return(builder);
        }
Exemplo n.º 3
0
 public RabbitMqEventPublisher(IBusClient busClient, ElwarkRabbitConfiguration configuration)
 {
     _busClient     = busClient;
     _configuration = configuration;
 }