Ejemplo n.º 1
0
    public RabbitMqDistributedEventBus(
        IOptions <AbpRabbitMqEventBusOptions> options,
        IConnectionPool connectionPool,
        IRabbitMqSerializer serializer,
        IServiceScopeFactory serviceScopeFactory,
        IOptions <AbpDistributedEventBusOptions> distributedEventBusOptions,
        IRabbitMqMessageConsumerFactory messageConsumerFactory,
        ICurrentTenant currentTenant,
        IUnitOfWorkManager unitOfWorkManager,
        IGuidGenerator guidGenerator,
        IClock clock,
        IEventHandlerInvoker eventHandlerInvoker)
        : base(
            serviceScopeFactory,
            currentTenant,
            unitOfWorkManager,
            distributedEventBusOptions,
            guidGenerator,
            clock,
            eventHandlerInvoker)
    {
        ConnectionPool             = connectionPool;
        Serializer                 = serializer;
        MessageConsumerFactory     = messageConsumerFactory;
        AbpRabbitMqEventBusOptions = options.Value;

        HandlerFactories = new ConcurrentDictionary <Type, List <IEventHandlerFactory> >();
        EventTypes       = new ConcurrentDictionary <string, Type>();
    }
 public RabbitMqService(
     IOptions <RabbitMqOption> options,
     IRabbitMqMessageConsumerFactory messageConsumerFactory
     )
 {
     MessageConsumerFactory = messageConsumerFactory;
     RabbitMqOptions        = options.Value;
 }
 public MyRabbitMqDistributedEventBus(
     IOptions <AbpRabbitMqEventBusOptions> options,
     IConnectionPool connectionPool,
     IRabbitMqSerializer serializer,
     IServiceScopeFactory serviceScopeFactory,
     IOptions <AbpDistributedEventBusOptions> distributedEventBusOptions,
     IRabbitMqMessageConsumerFactory messageConsumerFactory) :
     base(options, connectionPool, serializer, serviceScopeFactory, distributedEventBusOptions, messageConsumerFactory)
 {
 }
Ejemplo n.º 4
0
 public AutoRabbitMQConsumer(
     ITypeFinder typeFinder,
     IIocResolver iocResolver,
     IObjectSerializer objectSerializer,
     IRabbitMqMessageConsumerFactory consumerFactory)
 {
     this.typeFinder       = typeFinder;
     this.iocResolver      = iocResolver;
     this.objectSerializer = objectSerializer;
     this.consumerFactory  = consumerFactory;
 }
 public RabbitMqMessageSubscribe(
     IMessageHandlerManager messageHandlerManager,
     IMessageHandlerProvider messageHandlerProvider,
     IRabbitMqMessageConsumerFactory rabbitMqMessageConsumerFactory,
     IOptions <EventBusRabbitMqOptions> options,
     ILogger <RabbitMqMessageSubscribe> logger)
 {
     _messageHandlerManager          = messageHandlerManager;
     _messageHandlerProvider         = messageHandlerProvider;
     _rabbitMqMessageConsumerFactory = rabbitMqMessageConsumerFactory;
     _options = options;
     _logger  = logger;
     RabbitMqMessageConsumerDic            = new ConcurrentDictionary <string, IRabbitMqMessageConsumer>();
     messageHandlerManager.OnEventRemoved += SubsManager_OnEventRemoved;
 }
        public RabbitMQEventBus(
            IOptions <RabbitMqEventBusOptions> options,
            IConnectionPool connectionPool,
            IRabbitMqSerializer serializer,
            IRabbitMqMessageConsumerFactory messageConsumerFactory)
            : base()
        {
            ConnectionPool          = connectionPool;
            Serializer              = serializer;
            MessageConsumerFactory  = messageConsumerFactory;
            RabbitMqEventBusOptions = options.Value;

            HandlerFactories = new ConcurrentDictionary <Type, List <IEventHandlerFactory> >();
            EventTypes       = new ConcurrentDictionary <string, Type>();
            Initialize();
        }
 public RabbitMQBusComMediator(
     IMediator mediator,
     IOptions <AbpRabbitMqEventBusOptions> options,
     IConnectionPool connectionPool,
     IRabbitMqSerializer serializer,
     IServiceScopeFactory serviceScopeFactory,
     IOptions <AbpDistributedEventBusOptions> distributedEventBusOptions,
     IRabbitMqMessageConsumerFactory messageConsumerFactory)
     :   base(options,
              connectionPool,
              serializer,
              serviceScopeFactory,
              distributedEventBusOptions,
              messageConsumerFactory)
 {
     _mediator = mediator;
 }
Ejemplo n.º 8
0
        public RabbitMqDistributedEventBus(
            IOptions <RocketRabbitMqEventBusOptions> options,
            IConnectionPool connectionPool,
            IRabbitMqSerializer serializer,
            IServiceScopeFactory serviceScopeFactory,
            IOptions <RocketDistributedEventBusOptions> distributedEventBusOptions,
            IRabbitMqMessageConsumerFactory messageConsumerFactory) : base(serviceScopeFactory)
        {
            ConnectionPool                   = connectionPool;
            Serializer                       = serializer;
            MessageConsumerFactory           = messageConsumerFactory;
            RocketDistributedEventBusOptions = distributedEventBusOptions.Value;
            RocketRabbitMqEventBusOptions    = options.Value;

            HandlerFactories = new ConcurrentDictionary <Type, List <IEventHandlerFactory> > ();
            EventTypes       = new ConcurrentDictionary <string, Type> ();
        }
Ejemplo n.º 9
0
 public EventBusRabbitMq(
     IRabbitMqPersistentConnection persistentConnection,
     IRabbitMqMessageConsumerFactory rabbitMqMessageConsumerFactory,
     IEventBusSubscriptionsManager subsManager,
     IEventHandlerFactory eventHandlerFactory,
     ILogger <EventBusRabbitMq> logger,
     IOptions <EventBusRabbitMqOptions> options)
 {
     _eventBusRabbitMqOptions        = options.Value;
     _persistentConnection           = persistentConnection;
     _rabbitMqMessageConsumerFactory = rabbitMqMessageConsumerFactory;
     _subsManager         = subsManager;
     _eventHandlerFactory = eventHandlerFactory;
     _logger = logger;
     RabbitMqMessageConsumerDic   = new ConcurrentDictionary <string, IRabbitMqMessageConsumer>();
     _subsManager.OnEventRemoved += SubsManager_OnEventRemoved;
 }
Ejemplo n.º 10
0
 public EventBusRabbitMq(
     IRabbitMqPersistentConnection persistentConnection,
     IRabbitMqMessageConsumerFactory rabbitMqMessageConsumerFactory,
     IEventBusSubscriptionsManager subsManager,
     IEventHandlerFactory eventHandlerFactory,
     ILogger <EventBusRabbitMq> logger,
     IOptions <EventBusRabbitMqOptions> options)
 {
     _eventBusRabbitMqOptions        = options.Value;
     _persistentConnection           = persistentConnection ?? throw new ArgumentNullException(nameof(persistentConnection));
     _rabbitMqMessageConsumerFactory = rabbitMqMessageConsumerFactory;
     _subsManager         = subsManager ?? throw new ArgumentNullException(nameof(subsManager));
     _eventHandlerFactory = eventHandlerFactory ?? throw new ArgumentNullException(nameof(eventHandlerFactory));
     _logger = logger ?? throw new ArgumentNullException(nameof(logger));
     RabbitMqMessageConsumerDic   = new ConcurrentDictionary <string, IRabbitMqMessageConsumer>();
     _subsManager.OnEventRemoved += SubsManager_OnEventRemoved;
 }
Ejemplo n.º 11
0
        public RabbitMqDistributedEventBus(
            IOptions <AbpRabbitMqEventBusOptions> options,
            IConnectionPool connectionPool,
            IRabbitMqSerializer serializer,
            IServiceScopeFactory serviceScopeFactory,
            IOptions <AbpDistributedEventBusOptions> distributedEventBusOptions,
            IRabbitMqMessageConsumerFactory messageConsumerFactory,
            ICurrentTenant currentTenant,
            IEventErrorHandler errorHandler,
            IOptions <AbpEventBusOptions> abpEventBusOptions)
            : base(serviceScopeFactory, currentTenant, errorHandler)
        {
            ConnectionPool                = connectionPool;
            Serializer                    = serializer;
            MessageConsumerFactory        = messageConsumerFactory;
            AbpEventBusOptions            = abpEventBusOptions.Value;
            AbpDistributedEventBusOptions = distributedEventBusOptions.Value;
            AbpRabbitMqEventBusOptions    = options.Value;

            HandlerFactories = new ConcurrentDictionary <Type, List <IEventHandlerFactory> >();
            EventTypes       = new ConcurrentDictionary <string, Type>();
        }
Ejemplo n.º 12
0
        public RabbitMqDistributedEventBus(
            IOptions <RabbitMqEventBusOptions> options,
            IConnectionPool connectionPool,
            IRabbitMqSerializer serializer,
            IHybridServiceScopeFactory serviceScopeFactory,
            IOptions <DistributedEventBusOptions> distributedEventBusOptions,
            IRabbitMqMessageConsumerFactory messageConsumerFactory)
            : base(serviceScopeFactory)
        {
            ConnectionPool             = connectionPool;
            Serializer                 = serializer;
            MessageConsumerFactory     = messageConsumerFactory;
            DistributedEventBusOptions = distributedEventBusOptions.Value;
            RabbitMqEventBusOptions    = options.Value;

            HandlerFactories = new ConcurrentDictionary <Type, List <IEventHandlerFactory> >();
            EventTypes       = new ConcurrentDictionary <string, Type>();

            Consumer = MessageConsumerFactory.Create(
                new ExchangeDeclareConfiguration(
                    RabbitMqEventBusOptions.ExchangeName,
                    type: "direct",
                    durable: true
                    ),
                new QueueDeclareConfiguration(
                    RabbitMqEventBusOptions.ClientName,
                    durable: true,
                    exclusive: false,
                    autoDelete: false
                    ),
                RabbitMqEventBusOptions.ConnectionName
                );

            Consumer.OnMessageReceived(ProcessEventAsync);

            SubscribeHandlers(DistributedEventBusOptions.Handlers);
        }