public ReplyMessageService(IRabbitService rabbitService) { _channel = rabbitService.GetChannel(); replyQueueName = rabbitService.GetReplyQueueName(); _channel.QueueDeclare(replyQueueName, false, false, false, null); consumer = new EventingBasicConsumer(_channel); consumer.Received += (model, ea) => { var body = ea.Body; var message = Encoding.UTF8.GetString(body); var tab = message.Split("."); observerHandler.SetObserver(tab[0], tab[1]); }; _channel.BasicConsume(replyQueueName, true, consumer); observerHandler = new ReplyObserverHandler(); Console.WriteLine("Created replies handler"); }
public MessageService(IRabbitService rabbitService) { _channel = rabbitService.GetChannel(); replyQueueName = rabbitService.GetReplyQueueName(); _channel.QueueDeclare(replyQueueName, false, false, false, null); props = _channel.CreateBasicProperties(); props.ReplyTo = replyQueueName; Console.WriteLine("Created messages handler"); }