Beispiel #1
0
 public PublisherManager(
     IClientCommandDispatcher clientCommandDispatcher,
     IPublishConfirmationListener confirmationListener)
 {
     this.clientCommandDispatcher = clientCommandDispatcher;
     this.confirmationListener    = confirmationListener;
 }
Beispiel #2
0
 public RabbitAdvancedBus(
     IConnectionFactory connectionFactory,
     IClientCommandDispatcherFactory clientCommandDispatcherFactory,
     IPublishConfirmationListener confirmationListener)
 {
     this.confirmationListener = confirmationListener;
     connection = new PersistentConnection(connectionFactory);
     clientCommandDispatcher = clientCommandDispatcherFactory.GetClientCommandDispatcher(connection);
     connection.Initialize();
 }
 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)
 {
 }
Beispiel #4
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)
 {
 }
Beispiel #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();
        }
Beispiel #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),
            };
        }