/// <summary> /// Initializes a new instance of the <see cref="RMQMessageGateway"/> class. /// Use if you need to inject a test logger /// <param name="connection">The amqp uri and exchange to connect to</param> /// </summary> protected RMQMessageGateway(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 = Connection.Exchange.SupportDelay; }
/// <summary> /// Initializes a new instance of the <see cref="RmqMessageGateway" /> class. /// Use if you need to inject a test logger /// </summary> /// <param name="connection">The amqp uri and exchange to connect to</param> /// <param name="batchSize">How many messages to read from a channel at one time. Only used by consumer, defaults to 1</param> protected RmqMessageGateway(RmqMessagingGatewayConnection connection) { Connection = connection; var connectionPolicyFactory = new ConnectionPolicyFactory(Connection); _retryPolicy = connectionPolicyFactory.RetryPolicy; _circuitBreakerPolicy = connectionPolicyFactory.CircuitBreakerPolicy; _connectionFactory = new ConnectionFactory { Uri = Connection.AmpqUri.Uri, RequestedHeartbeat = TimeSpan.FromSeconds(connection.Heartbeat) }; DelaySupported = Connection.Exchange.SupportDelay; }
/// <summary> /// Initializes a new instance of the <see cref="RMQMessageGateway" /> class. /// Use if you need to inject a test logger /// <param name="connection">The amqp uri and exchange to connect to</param> /// </summary> protected RMQMessageGateway(RmqMessagingGatewayConnection connection, int batchSize = 1) { Connection = connection; _batchSize = Convert.ToUInt16(batchSize); var connectionPolicyFactory = new ConnectionPolicyFactory(Connection); _retryPolicy = connectionPolicyFactory.RetryPolicy; _circuitBreakerPolicy = connectionPolicyFactory.CircuitBreakerPolicy; _connectionFactory = new ConnectionFactory { Uri = Connection.AmpqUri.Uri, RequestedHeartbeat = connection.Heartbeat }; DelaySupported = Connection.Exchange.SupportDelay; }