예제 #1
0
 /// <summary>
 ///     Creates PullingConsumerFactory
 /// </summary>
 /// <param name="channelFactory">The channel factory</param>
 /// <param name="produceConsumeInterceptor">The produce-consume interceptor</param>
 /// <param name="messageSerializationStrategy">The message serialization strategy</param>
 public PullingConsumerFactory(
     IPersistentChannelFactory channelFactory,
     IProduceConsumeInterceptor produceConsumeInterceptor,
     IMessageSerializationStrategy messageSerializationStrategy
     )
 {
     this.channelFactory               = channelFactory;
     this.produceConsumeInterceptor    = produceConsumeInterceptor;
     this.messageSerializationStrategy = messageSerializationStrategy;
 }
 public ElasticApmAdvancedBus(IConnectionFactory connectionFactory, IConsumerFactory consumerFactory,
                              IClientCommandDispatcherFactory clientCommandDispatcherFactory,
                              IPublishConfirmationListener confirmationListener, IEventBus eventBus,
                              IHandlerCollectionFactory handlerCollectionFactory, IServiceResolver container,
                              ConnectionConfiguration connectionConfiguration, IProduceConsumeInterceptor produceConsumeInterceptor,
                              IMessageSerializationStrategy messageSerializationStrategy, IConventions conventions,
                              AdvancedBusEventHandlers advancedBusEventHandlers, IPersistentConnectionFactory persistentConnectionFactory,
                              ILogProvider logProvider)
     : base(connectionFactory, consumerFactory, clientCommandDispatcherFactory, confirmationListener, eventBus,
            handlerCollectionFactory, container, connectionConfiguration, produceConsumeInterceptor,
            messageSerializationStrategy, conventions, advancedBusEventHandlers, persistentConnectionFactory)
 {
 }
예제 #3
0
 public MyRabbitAdvancedBus(IConnectionFactory connectionFactory,
                            IConsumerFactory consumerFactory,
                            IEasyNetQLogger logger,
                            IClientCommandDispatcherFactory clientCommandDispatcherFactory,
                            IPublishConfirmationListener confirmationListener,
                            IEventBus eventBus,
                            IHandlerCollectionFactory handlerCollectionFactory,
                            IContainer container,
                            ConnectionConfiguration connectionConfiguration,
                            IProduceConsumeInterceptor produceConsumeInterceptor,
                            IMessageSerializationStrategy messageSerializationStrategy,
                            IConventions conventions,
                            AdvancedBusEventHandlers advancedBusEventHandlers,
                            IPersistentConnectionFactory persistentConnectionFactory) : base(connectionFactory, consumerFactory, logger, clientCommandDispatcherFactory, confirmationListener, eventBus, handlerCollectionFactory, container, connectionConfiguration, produceConsumeInterceptor, messageSerializationStrategy, conventions, advancedBusEventHandlers, persistentConnectionFactory)
 {
 }
예제 #4
0
        public RabbitAdvancedBus(
            IConnectionFactory connectionFactory,
            IConsumerFactory consumerFactory,
            IEasyNetQLogger logger,
            IClientCommandDispatcherFactory clientCommandDispatcherFactory,
            IPublisher publisher,
            IEventBus eventBus,
            IHandlerCollectionFactory handlerCollectionFactory,
            IContainer container,
            IConnectionConfiguration connectionConfiguration,
            IProduceConsumeInterceptor produceConsumeInterceptor,
            IMessageSerializationStrategy messageSerializationStrategy)
        {
            Preconditions.CheckNotNull(connectionFactory, "connectionFactory");
            Preconditions.CheckNotNull(consumerFactory, "consumerFactory");
            Preconditions.CheckNotNull(logger, "logger");
            Preconditions.CheckNotNull(publisher, "publisher");
            Preconditions.CheckNotNull(eventBus, "eventBus");
            Preconditions.CheckNotNull(handlerCollectionFactory, "handlerCollectionFactory");
            Preconditions.CheckNotNull(container, "container");
            Preconditions.CheckNotNull(messageSerializationStrategy, "messageSerializationStrategy");
            Preconditions.CheckNotNull(connectionConfiguration, "connectionConfiguration");
            Preconditions.CheckNotNull(produceConsumeInterceptor, "produceConsumeInterceptor");

            this.consumerFactory              = consumerFactory;
            this.logger                       = logger;
            this.publisher                    = publisher;
            this.eventBus                     = eventBus;
            this.handlerCollectionFactory     = handlerCollectionFactory;
            this.container                    = container;
            this.connectionConfiguration      = connectionConfiguration;
            this.produceConsumeInterceptor    = produceConsumeInterceptor;
            this.messageSerializationStrategy = messageSerializationStrategy;

            connection = new PersistentConnection(connectionFactory, logger, eventBus);

            eventBus.Subscribe <ConnectionCreatedEvent>(e => OnConnected());
            eventBus.Subscribe <ConnectionDisconnectedEvent>(e => OnDisconnected());
            eventBus.Subscribe <ConnectionBlockedEvent>(e => OnBlocked());
            eventBus.Subscribe <ConnectionUnblockedEvent>(e => OnUnblocked());
            eventBus.Subscribe <ReturnedMessageEvent>(OnMessageReturned);

            clientCommandDispatcher = clientCommandDispatcherFactory.GetClientCommandDispatcher(connection);
        }
예제 #5
0
 public ExternalScheduler(
     IAdvancedBus advancedBus,
     IConventions conventions,
     ITypeNameSerializer typeNameSerializer,
     IExchangeDeclareStrategy exchangeDeclareStrategy,
     IMessageDeliveryModeStrategy messageDeliveryModeStrategy,
     IMessageSerializationStrategy messageSerializationStrategy
     )
 {
     this.advancedBus             = advancedBus ?? throw new ArgumentNullException(nameof(advancedBus));
     this.conventions             = conventions ?? throw new ArgumentNullException(nameof(conventions));
     this.typeNameSerializer      = typeNameSerializer ?? throw new ArgumentNullException(nameof(typeNameSerializer));
     this.exchangeDeclareStrategy = exchangeDeclareStrategy ??
                                    throw new ArgumentNullException(nameof(exchangeDeclareStrategy));
     this.messageDeliveryModeStrategy = messageDeliveryModeStrategy ??
                                        throw new ArgumentNullException(nameof(messageDeliveryModeStrategy));
     this.messageSerializationStrategy = messageSerializationStrategy ??
                                         throw new ArgumentNullException(nameof(messageSerializationStrategy));
 }
예제 #6
0
        public ExternalScheduler(
            IAdvancedBus advancedBus,
            IConventions conventions,
            ITypeNameSerializer typeNameSerializer,
            IPublishExchangeDeclareStrategy publishExchangeDeclareStrategy,
            IMessageDeliveryModeStrategy messageDeliveryModeStrategy,
            IMessageSerializationStrategy messageSerializationStrategy)
        {
            Preconditions.CheckNotNull(advancedBus, "advancedBus");
            Preconditions.CheckNotNull(conventions, "conventions");
            Preconditions.CheckNotNull(publishExchangeDeclareStrategy, "publishExchangeDeclareStrategy");
            Preconditions.CheckNotNull(messageDeliveryModeStrategy, "messageDeliveryModeStrategy");
            Preconditions.CheckNotNull(messageSerializationStrategy, "messageSerializationStrategy");
            Preconditions.CheckNotNull(typeNameSerializer, "typeNameSerializer");

            this.advancedBus                    = advancedBus;
            this.conventions                    = conventions;
            this.typeNameSerializer             = typeNameSerializer;
            this.publishExchangeDeclareStrategy = publishExchangeDeclareStrategy;
            this.messageDeliveryModeStrategy    = messageDeliveryModeStrategy;
            this.messageSerializationStrategy   = messageSerializationStrategy;
        }
예제 #7
0
        public ExternalScheduler(
            IAdvancedBus advancedBus,
            IConventions conventions,
            ITypeNameSerializer typeNameSerializer,
            IExchangeDeclareStrategy exchangeDeclareStrategy,
            IMessageDeliveryModeStrategy messageDeliveryModeStrategy,
            IMessageSerializationStrategy messageSerializationStrategy)
        {
            Preconditions.CheckNotNull(advancedBus, nameof(advancedBus));
            Preconditions.CheckNotNull(conventions, nameof(conventions));
            Preconditions.CheckNotNull(exchangeDeclareStrategy, nameof(exchangeDeclareStrategy));
            Preconditions.CheckNotNull(messageDeliveryModeStrategy, nameof(messageDeliveryModeStrategy));
            Preconditions.CheckNotNull(messageSerializationStrategy, nameof(messageSerializationStrategy));
            Preconditions.CheckNotNull(typeNameSerializer, nameof(typeNameSerializer));

            this.advancedBus                  = advancedBus;
            this.conventions                  = conventions;
            this.typeNameSerializer           = typeNameSerializer;
            this.exchangeDeclareStrategy      = exchangeDeclareStrategy;
            this.messageDeliveryModeStrategy  = messageDeliveryModeStrategy;
            this.messageSerializationStrategy = messageSerializationStrategy;
        }
예제 #8
0
        public RabbitAdvancedBus(
            IConnectionFactory connectionFactory,
            IConsumerFactory consumerFactory,
            IEasyNetQLogger logger,
            IClientCommandDispatcherFactory clientCommandDispatcherFactory,
            IPublishConfirmationListener confirmationListener,
            IEventBus eventBus,
            IHandlerCollectionFactory handlerCollectionFactory,
            IContainer container,
            ConnectionConfiguration connectionConfiguration,
            IProduceConsumeInterceptor produceConsumeInterceptor,
            IMessageSerializationStrategy messageSerializationStrategy,
            IConventions conventions,
            AdvancedBusEventHandlers advancedBusEventHandlers,
            IPersistentConnectionFactory persistentConnectionFactory)
        {
            Preconditions.CheckNotNull(connectionFactory, "connectionFactory");
            Preconditions.CheckNotNull(consumerFactory, "consumerFactory");
            Preconditions.CheckNotNull(logger, "logger");
            Preconditions.CheckNotNull(eventBus, "eventBus");
            Preconditions.CheckNotNull(handlerCollectionFactory, "handlerCollectionFactory");
            Preconditions.CheckNotNull(container, "container");
            Preconditions.CheckNotNull(messageSerializationStrategy, "messageSerializationStrategy");
            Preconditions.CheckNotNull(connectionConfiguration, "connectionConfiguration");
            Preconditions.CheckNotNull(produceConsumeInterceptor, "produceConsumeInterceptor");
            Preconditions.CheckNotNull(conventions, "conventions");
            Preconditions.CheckNotNull(advancedBusEventHandlers, "advancedBusEventHandlers");
            Preconditions.CheckNotNull(persistentConnectionFactory, "persistentConnectionFactory");

            this.consumerFactory              = consumerFactory;
            this.logger                       = logger;
            this.confirmationListener         = confirmationListener;
            this.eventBus                     = eventBus;
            this.handlerCollectionFactory     = handlerCollectionFactory;
            this.container                    = container;
            this.connectionConfiguration      = connectionConfiguration;
            this.produceConsumeInterceptor    = produceConsumeInterceptor;
            this.messageSerializationStrategy = messageSerializationStrategy;
            this.conventions                  = conventions;

            this.eventBus.Subscribe <ConnectionCreatedEvent>(e => OnConnected());
            if (advancedBusEventHandlers.Connected != null)
            {
                Connected += advancedBusEventHandlers.Connected;
            }
            this.eventBus.Subscribe <ConnectionDisconnectedEvent>(e => OnDisconnected());
            if (advancedBusEventHandlers.Disconnected != null)
            {
                Disconnected += advancedBusEventHandlers.Disconnected;
            }
            this.eventBus.Subscribe <ConnectionBlockedEvent>(OnBlocked);
            if (advancedBusEventHandlers.Blocked != null)
            {
                Blocked += advancedBusEventHandlers.Blocked;
            }
            this.eventBus.Subscribe <ConnectionUnblockedEvent>(e => OnUnblocked());
            if (advancedBusEventHandlers.Unblocked != null)
            {
                Unblocked += advancedBusEventHandlers.Unblocked;
            }
            this.eventBus.Subscribe <ReturnedMessageEvent>(OnMessageReturned);
            if (advancedBusEventHandlers.MessageReturned != null)
            {
                MessageReturned += advancedBusEventHandlers.MessageReturned;
            }

            connection = persistentConnectionFactory.CreateConnection();
            clientCommandDispatcher = clientCommandDispatcherFactory.GetClientCommandDispatcher(connection);
            connection.Initialize();
        }
예제 #9
0
        /// <summary>
        ///     Creates RabbitAdvancedBus
        /// </summary>
        public RabbitAdvancedBus(
            IPersistentConnection connection,
            IConsumerFactory consumerFactory,
            IClientCommandDispatcher clientCommandDispatcher,
            IPublishConfirmationListener confirmationListener,
            IEventBus eventBus,
            IHandlerCollectionFactory handlerCollectionFactory,
            IServiceResolver container,
            ConnectionConfiguration configuration,
            IProduceConsumeInterceptor produceConsumeInterceptor,
            IMessageSerializationStrategy messageSerializationStrategy,
            IConventions conventions,
            IPullingConsumerFactory pullingConsumerFactory,
            AdvancedBusEventHandlers advancedBusEventHandlers
            )
        {
            Preconditions.CheckNotNull(connection, "connection");
            Preconditions.CheckNotNull(consumerFactory, "consumerFactory");
            Preconditions.CheckNotNull(eventBus, "eventBus");
            Preconditions.CheckNotNull(handlerCollectionFactory, "handlerCollectionFactory");
            Preconditions.CheckNotNull(container, "container");
            Preconditions.CheckNotNull(messageSerializationStrategy, "messageSerializationStrategy");
            Preconditions.CheckNotNull(configuration, "configuration");
            Preconditions.CheckNotNull(produceConsumeInterceptor, "produceConsumeInterceptor");
            Preconditions.CheckNotNull(conventions, "conventions");
            Preconditions.CheckNotNull(pullingConsumerFactory, "pullingConsumerFactory");
            Preconditions.CheckNotNull(advancedBusEventHandlers, "advancedBusEventHandlers");

            this.connection              = connection;
            this.consumerFactory         = consumerFactory;
            this.clientCommandDispatcher = clientCommandDispatcher;
            this.confirmationListener    = confirmationListener;
            this.eventBus = eventBus;
            this.handlerCollectionFactory = handlerCollectionFactory;
            this.Container                    = container;
            this.configuration                = configuration;
            this.produceConsumeInterceptor    = produceConsumeInterceptor;
            this.messageSerializationStrategy = messageSerializationStrategy;
            this.pullingConsumerFactory       = pullingConsumerFactory;
            this.Conventions                  = conventions;

            if (advancedBusEventHandlers.Connected != null)
            {
                Connected += advancedBusEventHandlers.Connected;
            }

            if (advancedBusEventHandlers.Disconnected != null)
            {
                Disconnected += advancedBusEventHandlers.Disconnected;
            }

            if (advancedBusEventHandlers.Blocked != null)
            {
                Blocked += advancedBusEventHandlers.Blocked;
            }

            if (advancedBusEventHandlers.Unblocked != null)
            {
                Unblocked += advancedBusEventHandlers.Unblocked;
            }

            if (advancedBusEventHandlers.MessageReturned != null)
            {
                MessageReturned += advancedBusEventHandlers.MessageReturned;
            }

            eventSubscriptions = new[]
            {
                this.eventBus.Subscribe <ConnectionCreatedEvent>(OnConnectionCreated),
                this.eventBus.Subscribe <ConnectionRecoveredEvent>(OnConnectionRecovered),
                this.eventBus.Subscribe <ConnectionDisconnectedEvent>(OnConnectionDisconnected),
                this.eventBus.Subscribe <ConnectionBlockedEvent>(OnConnectionBlocked),
                this.eventBus.Subscribe <ConnectionUnblockedEvent>(OnConnectionUnblocked),
                this.eventBus.Subscribe <ReturnedMessageEvent>(OnMessageReturned),
            };
        }