public IRabbitMqConsumer Create(ExchangeDeclareConfiguration exchange, QueueDeclareConfiguration queue, string connectionName = default) { var consumer = ServiceScope.ServiceProvider.GetRequiredService <RabbitMqConsumer>(); consumer.Initialize(exchange, queue, connectionName); return(consumer); }
public void Initialize( [NotNull] ExchangeDeclareConfiguration exchange, [NotNull] QueueDeclareConfiguration queue, string connectionName = null) { Exchange = Check.NotNull(exchange, nameof(exchange)); Queue = Check.NotNull(queue, nameof(queue)); ConnectionName = connectionName; Timer.StartAsync().Wait(); }