Example #1
0
        public ConsumerIndex(IEnumerable <IEventConsumer> consumers)
        {
            this.index = new Dictionary <string, ConsumerDescriptor>();

            IConsumerIndex.InitializeIndex(consumers, descriptor =>
            {
                this.index.Add(descriptor.EventDescriptor.FullName, descriptor);
            });
        }
Example #2
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));
            }
        }