public ReliableEventsDispatcher(
     ILogger <ReliableEventsDispatcher> logger,
     IServiceProvider serviceProvider,
     IOptions <ConnectionOptions> serviceBusConnectionOptions,
     IReliableEventMapper eventMapper)
 {
     this.logger                      = logger;
     this.serviceProvider             = serviceProvider;
     this.serviceBusConnectionOptions = serviceBusConnectionOptions.Value;
     this.eventMapper                 = eventMapper;
 }
        public static void AddReliableEventsDispatcher(this IServiceCollection services,
                                                       string notificationQueueName,
                                                       string notificationQueueConnection,
                                                       IReliableEventMapper reliableEventMapper)
        {
            services.AddSingleton <ReliableEventsDispatcher>();
            services.AddSingleton <IHostedService, ReliableEventsDispatcherService>();

            services.Configure <ConnectionOptions>(options =>
            {
                options.NotificationQueueName       = notificationQueueName;
                options.NotificationQueueConnection = notificationQueueConnection;
            });

            services.AddSingleton <INotificationHandler <EventsAvailableNotification>, NotificationPublisher>();

            services.AddSingleton(reliableEventMapper);

            services.AddScoped <IIntegrationEventPublisher, DummyIntegrationEventPublisher>();
        }
Example #3
0
        public static void AddReliableEventsDispatcher(this IServiceCollection services, IConfiguration configuration, IReliableEventMapper reliableEventMapper)
        {
            services.AddSingleton <ReliableEventsDispatcher>();
            services.AddSingleton <IHostedService, ReliableEventsDispatcherService>();

            services.Configure <ConnectionOptions>(configuration.GetSection("ServiceBus"));
            services.AddSingleton <INotificationHandler <EventsAvailableNotification>, NotificationPublisher>();

            services.AddSingleton(reliableEventMapper);
        }