Class ConnectionPolicyFactory.
Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MessageGateway"/> class.
        /// Use if you need to inject a test logger
        /// <param name="connection">The amqp uri and exchange to connect to</param>
        /// </summary>
        protected MessageGateway(RmqMessagingGatewayConnection connection)
        {
            Connection = connection;

            var connectionPolicyFactory = new ConnectionPolicyFactory(Connection);

            _retryPolicy = connectionPolicyFactory.RetryPolicy;
            _circuitBreakerPolicy = connectionPolicyFactory.CircuitBreakerPolicy;

            _connectionFactory = new ConnectionFactory { Uri = Connection.AmpqUri.Uri.ToString(), RequestedHeartbeat = 30 };

            DelaySupported = this is IAmAMessageGatewaySupportingDelay && Connection.Exchange.SupportDelay;
        }
Ejemplo n.º 2
0
        public MessageGateway(ILog logger)
        {
            this.Logger   = logger;
            Configuration = RMQMessagingGatewayConfigurationSection.GetConfiguration();

            var connectionPolicyFactory = new ConnectionPolicyFactory(logger);

            retryPolicy          = connectionPolicyFactory.RetryPolicy;
            circuitBreakerPolicy = connectionPolicyFactory.CircuitBreakerPolicy;

            connectionFactory = new ConnectionFactory {
                Uri = Configuration.AMPQUri.Uri.ToString(), RequestedHeartbeat = 30
            };
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MessageGateway"/> class.
        /// </summary>
        /// <param name="logger">The logger.</param>
        public MessageGateway(ILog logger)
        {
            Logger = logger;
            Configuration = RMQMessagingGatewayConfigurationSection.GetConfiguration();

            var connectionPolicyFactory = new ConnectionPolicyFactory(logger);

            _retryPolicy = connectionPolicyFactory.RetryPolicy;
            _circuitBreakerPolicy = connectionPolicyFactory.CircuitBreakerPolicy;

            _connectionFactory = new ConnectionFactory { Uri = Configuration.AMPQUri.Uri.ToString(), RequestedHeartbeat = 30 };

            DelaySupported = (this is IAmAMessageGatewaySupportingDelay) && Configuration.Exchange.SupportDelay;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MessageGateway"/> class.
        /// Use if you need to inject a test logger
        /// <param name="connection">The amqp uri and exchange to connect to</param>
        /// </summary>
        protected MessageGateway(RmqMessagingGatewayConnection connection)
        {
            Connection = connection;

            var connectionPolicyFactory = new ConnectionPolicyFactory(Connection);

            _retryPolicy          = connectionPolicyFactory.RetryPolicy;
            _circuitBreakerPolicy = connectionPolicyFactory.CircuitBreakerPolicy;

            _connectionFactory = new ConnectionFactory {
                Uri = Connection.AmpqUri.Uri.ToString(), RequestedHeartbeat = 30
            };

            DelaySupported = this is IAmAMessageGatewaySupportingDelay && Connection.Exchange.SupportDelay;
        }
Ejemplo n.º 5
0
        private MessageGateway(ILog logger, RMQMessagingGatewayConfigurationSection configuration)
        {
            Logger        = logger;
            Configuration = configuration;

            var connectionPolicyFactory = new ConnectionPolicyFactory(logger, Configuration);

            _retryPolicy          = connectionPolicyFactory.RetryPolicy;
            _circuitBreakerPolicy = connectionPolicyFactory.CircuitBreakerPolicy;

            _connectionFactory = new ConnectionFactory {
                Uri = Configuration.AMPQUri.Uri.ToString(), RequestedHeartbeat = 30
            };

            DelaySupported = (this is IAmAMessageGatewaySupportingDelay) && Configuration.Exchange.SupportDelay;
        }