Example #1
0
        public NotificationsQueueConsumerService(IConfiguration configuration, IHubContext <NotificationsHub> hub)
        {
            _hub = hub;
            var settings = configuration.Bind <QueueSettings>("Queues:NotificationsToSignalR");

            _consumer = new Consumer(OwnConnectionFactory.GetConnectionFactory(configuration), settings);
        }
Example #2
0
        public BuildStatusesQueueConsumerService(IConfiguration configuration, IServiceProvider serviceProvider)
        {
            _serviceProvider = serviceProvider;
            var settings = configuration.Bind <QueueSettings>("Queues:BuildStatuses");

            _consumer = new Consumer(OwnConnectionFactory.GetConnectionFactory(configuration), settings);
        }
        public static void RegisterRabbitMQ(this IServiceCollection services, IConfiguration configuration)
        {
            var toProcessorQueueSettings = configuration.Bind <QueueSettings>("Queues:ToProcessor");

            services.AddTransient(sp => new ProcessorProducer(OwnConnectionFactory.GetConnectionFactory(configuration), toProcessorQueueSettings));

            services.AddHostedService <BuildStatusesQueueConsumerService>();
        }
Example #4
0
        public BuildStatusesQueueConsumerService(IConfiguration configuration,
                                                 IHubContext <BuildStatusesHub> statusesHub, IHubContext <NotificationsHub> notificationsHub)
        {
            _statusesHub      = statusesHub;
            _notificationsHub = notificationsHub;
            var settings = configuration.Bind <QueueSettings>("Queues:BuildStatusesToSignalR");

            _consumer = new Consumer(OwnConnectionFactory.GetConnectionFactory(configuration), settings);
        }
 public static void RegisterConnectionFactory(this IServiceCollection services, IConfiguration configuration)
 {
     services.AddSingleton <IConnectionFactory>(_ => OwnConnectionFactory.GetConnectionFactory(configuration));
     services.AddSingleton <IProducerConsumerWrapper, ProducerConsumerWrapper>();
 }