public RabbitMQTransportInfrastructure(SettingsHolder settings, string connectionString)
        {
            this.settings = settings;

            var connectionConfiguration = ConnectionConfiguration.Create(connectionString, settings.EndpointName());

            X509CertificateCollection clientCertificates;

            settings.TryGet(SettingsKeys.ClientCertificates, out clientCertificates);
            connectionFactory = new ConnectionFactory(connectionConfiguration, clientCertificates);

            routingTopology = CreateRoutingTopology();

            routingTopologySupportsDelayedDelivery = routingTopology is ISupportDelayedDelivery;
            settings.Set(SettingsKeys.RoutingTopologySupportsDelayedDelivery, routingTopologySupportsDelayedDelivery);

            bool usePublisherConfirms;

            if (!settings.TryGet(SettingsKeys.UsePublisherConfirms, out usePublisherConfirms))
            {
                usePublisherConfirms = true;
            }

            settings.TryGet(SettingsKeys.DisableTimeoutManager, out disableTimeoutManager);

            bool allEndpointsSupportDelayedDelivery;

            settings.TryGet(SettingsKeys.AllEndpointsSupportDelayedDelivery, out allEndpointsSupportDelayedDelivery);

            channelProvider = new ChannelProvider(connectionFactory, routingTopology, usePublisherConfirms, allEndpointsSupportDelayedDelivery);

            RequireOutboxConsent = false;
        }
        public MessagePump(
            ReceiveSettings settings,
            ConnectionFactory connectionFactory,
            IRoutingTopology routingTopology,
            MessageConverter messageConverter,
            string consumerTag,
            ChannelProvider channelProvider,
            TimeSpan timeToWaitBeforeTriggeringCircuitBreaker,
            PrefetchCountCalculation prefetchCountCalculation,
            Action <string, Exception,
                    CancellationToken> criticalErrorAction,
            TimeSpan retryDelay)
        {
            this.settings          = settings;
            this.connectionFactory = connectionFactory;
            this.messageConverter  = messageConverter;
            this.consumerTag       = consumerTag;
            this.channelProvider   = channelProvider;
            this.timeToWaitBeforeTriggeringCircuitBreaker = timeToWaitBeforeTriggeringCircuitBreaker;
            this.prefetchCountCalculation = prefetchCountCalculation;
            this.criticalErrorAction      = criticalErrorAction;
            this.retryDelay = retryDelay;

            ReceiveAddress = RabbitMQTransportInfrastructure.TranslateAddress(settings.ReceiveAddress);

            if (settings.UsePublishSubscribe)
            {
                Subscriptions = new SubscriptionManager(connectionFactory, routingTopology, ReceiveAddress);
            }

            queuePurger = new QueuePurger(connectionFactory);

            name = $"{ReceiveAddress} MessagePump";
        }
Exemplo n.º 3
0
 public MessagePump(ConnectionFactory connectionFactory, MessageConverter messageConverter, string consumerTag, ChannelProvider channelProvider, QueuePurger queuePurger, TimeSpan timeToWaitBeforeTriggeringCircuitBreaker, int prefetchMultiplier, ushort overriddenPrefetchCount)
 {
     this.connectionFactory = connectionFactory;
     this.messageConverter  = messageConverter;
     this.consumerTag       = consumerTag;
     this.channelProvider   = channelProvider;
     this.queuePurger       = queuePurger;
     this.timeToWaitBeforeTriggeringCircuitBreaker = timeToWaitBeforeTriggeringCircuitBreaker;
     this.prefetchMultiplier      = prefetchMultiplier;
     this.overriddenPrefetchCount = overriddenPrefetchCount;
 }
Exemplo n.º 4
0
        public RabbitMQTransportInfrastructure(HostSettings hostSettings, ReceiveSettings[] receiverSettings, ConnectionFactory connectionFactory, IRoutingTopology routingTopology,
                                               ChannelProvider channelProvider, MessageConverter messageConverter,
                                               TimeSpan timeToWaitBeforeTriggeringCircuitBreaker, PrefetchCountCalculation prefetchCountCalculation)
        {
            this.connectionFactory = connectionFactory;
            this.routingTopology   = routingTopology;
            this.channelProvider   = channelProvider;

            Dispatcher = new MessageDispatcher(channelProvider);
            Receivers  = receiverSettings.Select(x => CreateMessagePump(hostSettings, x, messageConverter, timeToWaitBeforeTriggeringCircuitBreaker, prefetchCountCalculation))
                         .ToDictionary(x => x.Id, x => x);
        }
Exemplo n.º 5
0
        public RabbitMQTransportInfrastructure(SettingsHolder settings, string connectionString)
        {
            this.settings = settings;

            var endpointName            = settings.EndpointName();
            var connectionConfiguration = ConnectionConfiguration.Create(connectionString, endpointName);

            settings.TryGet(SettingsKeys.ClientCertificateCollection, out X509Certificate2Collection clientCertificateCollection);
            settings.TryGet(SettingsKeys.DisableRemoteCertificateValidation, out bool disableRemoteCertificateValidation);
            settings.TryGet(SettingsKeys.UseExternalAuthMechanism, out bool useExternalAuthMechanism);
            settings.TryGet(SettingsKeys.HeartbeatInterval, out TimeSpan? heartbeatInterval);
            settings.TryGet(SettingsKeys.NetworkRecoveryInterval, out TimeSpan? networkRecoveryInterval);

            connectionFactory = new ConnectionFactory(endpointName, connectionConfiguration, clientCertificateCollection, disableRemoteCertificateValidation, useExternalAuthMechanism, heartbeatInterval, networkRecoveryInterval);

            routingTopology = CreateRoutingTopology();

            channelProvider = new ChannelProvider(connectionFactory, connectionConfiguration.RetryDelay, routingTopology);
        }
Exemplo n.º 6
0
        public RabbitMQTransportInfrastructure(SettingsHolder settings, string connectionString)
        {
            this.settings = settings;

            var connectionConfiguration = ConnectionConfiguration.Create(connectionString, settings.EndpointName());

            settings.TryGet(SettingsKeys.ClientCertificates, out X509CertificateCollection clientCertificates);
            settings.TryGet(SettingsKeys.DisableRemoteCertificateValidation, out bool disableRemoteCertificateValidation);
            settings.TryGet(SettingsKeys.UseExternalAuthMechanism, out bool useExternalAuthMechanism);
            connectionFactory = new ConnectionFactory(connectionConfiguration, clientCertificates, disableRemoteCertificateValidation, useExternalAuthMechanism);

            routingTopology = CreateRoutingTopology();

            if (!settings.TryGet(SettingsKeys.UsePublisherConfirms, out bool usePublisherConfirms))
            {
                usePublisherConfirms = true;
            }

            channelProvider = new ChannelProvider(connectionFactory, connectionConfiguration.RetryDelay, routingTopology, usePublisherConfirms);
        }
Exemplo n.º 7
0
        public MessagePump(ConnectionFactory connectionFactory, IRoutingTopology routingTopology, MessageConverter messageConverter, string consumerTag,
                           ChannelProvider channelProvider, TimeSpan timeToWaitBeforeTriggeringCircuitBreaker,
                           PrefetchCountCalculation prefetchCountCalculation, ReceiveSettings settings,
                           Action <string, Exception, CancellationToken> criticalErrorAction)
        {
            this.connectionFactory = connectionFactory;
            this.messageConverter  = messageConverter;
            this.consumerTag       = consumerTag;
            this.channelProvider   = channelProvider;
            this.timeToWaitBeforeTriggeringCircuitBreaker = timeToWaitBeforeTriggeringCircuitBreaker;
            this.prefetchCountCalculation = prefetchCountCalculation;
            this.settings            = settings;
            this.criticalErrorAction = criticalErrorAction;

            if (settings.UsePublishSubscribe)
            {
                Subscriptions = new SubscriptionManager(connectionFactory, routingTopology, settings.ReceiveAddress);
            }

            queuePurger = new QueuePurger(connectionFactory);
        }
        public RabbitMQTransportInfrastructure(SettingsHolder settings, string connectionString)
        {
            this.settings = settings;

            var connectionConfiguration = new ConnectionStringParser(settings).Parse(connectionString);

            connectionFactory = new ConnectionFactory(connectionConfiguration);

            routingTopology = CreateRoutingTopology();

            bool usePublisherConfirms;

            if (!settings.TryGet(SettingsKeys.UsePublisherConfirms, out usePublisherConfirms))
            {
                usePublisherConfirms = true;
            }

            channelProvider = new ChannelProvider(connectionFactory, routingTopology, usePublisherConfirms);

            RequireOutboxConsent = false;
        }
        public RabbitMQTransportInfrastructure(SettingsHolder settings, string connectionString)
        {
            this.settings = settings;

            var connectionConfiguration = ConnectionConfiguration.Create(connectionString, settings.EndpointName());

            X509CertificateCollection clientCertificates;

            settings.TryGet(SettingsKeys.ClientCertificates, out clientCertificates);
            connectionFactory = new ConnectionFactory(connectionConfiguration, clientCertificates);

            routingTopology = CreateRoutingTopology();

            var routingTopologySupportsDelayedDelivery = routingTopology is ISupportDelayedDelivery;

            settings.Set(SettingsKeys.RoutingTopologySupportsDelayedDelivery, routingTopologySupportsDelayedDelivery);

            if (routingTopologySupportsDelayedDelivery)
            {
                var timeoutManagerFeatureDisabled = settings.GetOrDefault <FeatureState>(typeof(TimeoutManager).FullName) == FeatureState.Disabled;
                var sendOnlyEndpoint = settings.GetOrDefault <bool>(coreSendOnlyEndpointKey);

                if (timeoutManagerFeatureDisabled || sendOnlyEndpoint)
                {
                    settings.Set(SettingsKeys.DisableTimeoutManager, true);
                }
            }

            bool usePublisherConfirms;

            if (!settings.TryGet(SettingsKeys.UsePublisherConfirms, out usePublisherConfirms))
            {
                usePublisherConfirms = true;
            }

            channelProvider = new ChannelProvider(connectionFactory, routingTopology, usePublisherConfirms);

            RequireOutboxConsent = false;
        }
Exemplo n.º 10
0
 public MessageDispatcher(ChannelProvider channelProvider)
 {
     this.channelProvider = channelProvider;
 }