Beispiel #1
0
        public EventListener(
            IOptions <EventBusOptions> options,
            IConnection connection,
            IHostApplicationLifetime host,
            ILoggerFactory loggerFactory,
            IQueueCoordinator coordinator,
            IEnumerable <IEventConsumer> consumers)
            : base(options, connection)
        {
            this.host          = host;
            this.loggerFactory = loggerFactory;
            this.coordinator   = coordinator;
            this.logger        = loggerFactory.CreateLogger(this.GetType());
            this.consumers     = new Dictionary <string, ConsumerDescriptor>();

            IEventListener.InitializeConsumerTable(consumers, d =>
            {
                this.consumers.Add(d.EventDescriptor.FullName, d);
            });

            if (this.consumers.Count == 0)
            {
                throw new ArgumentException("No any valid consumers.", nameof(consumers));
            }
        }
Beispiel #2
0
 public EventReceiver(
     IModel channel,
     IQueueCoordinator coordinator,
     ILogger <EventReceiver> logger,
     IReadOnlyDictionary <string, ConsumerDescriptor> consumers)
     : base(channel)
 {
     this.coordinator = coordinator;
     this.logger      = logger;
     this.consumers   = consumers;
 }
Beispiel #3
0
        public EventListener(
            IOptions <EventBusOptions> options,
            IConnection connection,
            IConsumerIndex consumers,
            IHostApplicationLifetime host,
            ILoggerFactory loggerFactory,
            IQueueCoordinator coordinator)
            : base(options, connection)
        {
            this.consumers     = consumers;
            this.host          = host;
            this.loggerFactory = loggerFactory;
            this.coordinator   = coordinator;
            this.logger        = loggerFactory.CreateLogger(this.GetType());

            if (this.consumers.Count == 0)
            {
                throw new ArgumentException("No any valid consumers.", nameof(consumers));
            }
        }