Example #1
0
        public RabbitMQEventBus(IEventBusPersistentConnection <IModel> persistentConnection, ILogger <RabbitMQEventBus> logger, IEventBusSubscriptionsManager subsManager)
        {
            _persistentConnection = persistentConnection ?? throw new ArgumentNullException(nameof(persistentConnection));
            _logger          = logger ?? throw new ArgumentNullException(nameof(logger));
            _subsManager     = subsManager ?? new InMemoryEventBusSubscriptionsManager();
            _consumerChannel = CreateConsumerChannel();

            _subsManager.OnEventRemoved += SubsManager_OnEventRemoved;
        }
        public EventBus(IEventBusPersistentConnection persistentConnection, ILifetimeScope autofac, string serviceName)
        {
            _persistentConnection = persistentConnection ?? throw new ArgumentNullException(nameof(persistentConnection));
            _autofac = autofac ?? throw new ArgumentNullException(nameof(autofac));

            _serviceName = !string.IsNullOrWhiteSpace(serviceName) ? serviceName : throw new ArgumentNullException(nameof(serviceName));

            _eventTypes = new List <Type>();
            _handlers   = new Dictionary <string, Type>();

            _consumerChannel = CreateConsumerChannel();
        }