private void InitializeRabbitMqListener() { if (_channel == null) { return; } _channel.QueueDeclare(queue: _queueName, durable: true, exclusive: false, autoDelete: false, arguments: null); _channel.BasicConsume(queue: _queueName, autoAck: false, consumer: _consumer); using (var scope = _service.CreateScope()) { IPharmacyService pharmacyService = scope.ServiceProvider.GetRequiredService <IPharmacyService>(); foreach (PharmacySystem p in pharmacyService.GetPharmaciesBySubscribed(true)) { _channel.ExchangeDeclare(exchange: p.ActionsBenefitsExchangeName, type: ExchangeType.Fanout); _channel.QueueBind(queue: _queueName, exchange: p.ActionsBenefitsExchangeName, routingKey: ""); } } }
public IActionResult GetBySubscribed([FromBody] bool subscribed) { return(Ok(_pharmacySystemService.GetPharmaciesBySubscribed(subscribed))); }