public BusConnection(BusConnectionString connectionString, IBusSerializer serializer, IServiceScopeFactory serviceScopeFactory, IOptions <BusConnectionOptions> options, IBusLogger logger = null, IRetryBehavior retryBehavior = null) : this(GetConnectionFactory(connectionString), serializer, serviceScopeFactory, options, logger, retryBehavior) { }
internal Consumer(BusConnection connection, IBusLogger logger, IRetryBehavior retryBehavior, IServiceScopeFactory scopeFactory, ConsumerOptions <T> options) { _options = options ?? throw new ArgumentNullException(nameof(options)); _connection = connection ?? throw new ArgumentNullException(nameof(connection)); _logger = logger; _retryBehavior = retryBehavior ?? throw new ArgumentNullException(nameof(retryBehavior)); _scopeFactory = scopeFactory ?? throw new ArgumentNullException(nameof(scopeFactory)); _tasks = new Tasks(_options.ConsumerMaxParallelTasks); _channel = connection.ConsumerConnection.CreateModel(); _channel.BasicQos(0, options.PrefetchCount, false); DeclareAndBind(); _consumerTag = _channel.BasicConsume(_options.Queue.Name.Value, false, this); }
public BusInitializerOptions( string connectionString, bool validateCertificate, BusConnectionOptions connectionOptions, Type serializerImplementationType, Type loggerImplementationType, IRetryBehavior retryBehavior) { ConnectionString = connectionString ?? throw new ArgumentNullException(nameof(connectionString)); ValidateCertificate = validateCertificate; ConnectionOptions = connectionOptions ?? throw new ArgumentNullException(nameof(connectionOptions)); SerializerImplementationType = serializerImplementationType ?? throw new ArgumentNullException(nameof(serializerImplementationType)); LoggerImplementationType = loggerImplementationType; RetryBehavior = retryBehavior ?? throw new ArgumentNullException(nameof(retryBehavior)); }
public BusConnection(IConnectionFactory connectionFactory, IBusSerializer serializer, IServiceScopeFactory serviceScopeFactory, IOptions <BusConnectionOptions> options, IBusLogger logger = null, IRetryBehavior retryBehavior = null) { _serializer = serializer ?? throw new ArgumentNullException(nameof(serializer)); _serviceScopeFactory = serviceScopeFactory; _logger = logger; _options = options; _consumers = new ConcurrentBag <IConsumer>(); _connectionFactory = connectionFactory; _publisherBuffer = new BufferList <BatchItem>(_options.Value.PublisherBufferSize, TimeSpan.FromMilliseconds(_options.Value.PublisherBufferTtlInMilliseconds)); _publisherBuffer.Cleared += PublishBufferOnCleared; _retryBehavior = retryBehavior ?? new ConstantRetryBehavior(1); }
public BusInitializerOptionsBuilder UseConstantRetryBehavior(int coeficient) { _retryBehavior = new ConstantRetryBehavior(coeficient); return(this); }
public BusInitializerOptionsBuilder UseGeometricProgressionRetryBehavior(int coeficient, int initialValue = 1) { _retryBehavior = new GeometricProgressionRetryBehavior(coeficient, initialValue); return(this); }
public BusInitializerOptionsBuilder UseRetryBehabior(IRetryBehavior retryBehavior) { _retryBehavior = retryBehavior; return(this); }