Exemplo n.º 1
0
 public BusThatSendsConfirmations(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) : base(connectionFactory, consumerFactory, logger, clientCommandDispatcherFactory,
                                                                                            confirmationListener, eventBus, handlerCollectionFactory, container, connectionConfiguration, produceConsumeInterceptor, messageSerializationStrategy,
                                                                                            conventions, advancedBusEventHandlers)
 {
 }
Exemplo n.º 2
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;
 }
Exemplo n.º 3
0
 /// <summary>
 ///     Creates PullingConsumer
 /// </summary>
 /// <param name="options">The options</param>
 /// <param name="queue">The queue</param>
 /// <param name="channel">The channel</param>
 /// <param name="interceptor">The produce-consumer interceptor</param>
 public PullingConsumer(
     PullingConsumerOptions options,
     IQueue queue,
     IPersistentChannel channel,
     IProduceConsumeInterceptor interceptor
     )
 {
     this.queue       = queue;
     this.options     = options;
     this.channel     = channel;
     this.interceptor = interceptor;
 }
Exemplo n.º 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);
        }
Exemplo n.º 5
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();
        }
Exemplo n.º 6
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),
            };
        }
 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)
 {
 }
Exemplo n.º 8
0
 public void Add(IProduceConsumeInterceptor interceptor)
 {
     interceptors.Add(interceptor);
 }
Exemplo n.º 9
0
 /// <summary>
 ///     Add the interceptor to pipeline
 /// </summary>
 /// <param name="interceptor"></param>
 public void Add(IProduceConsumeInterceptor interceptor)
 {
     interceptors.Add(interceptor);
 }
Exemplo n.º 10
0
 /// <inheritdoc />
 public void Add(IProduceConsumeInterceptor interceptor)
 {
     compositeInterceptor.Add(interceptor);
 }
Exemplo n.º 11
0
 public void Add(IProduceConsumeInterceptor interceptor)
 {
     compositeInterceptor.Add(interceptor);
 }