public override Task ConsumeAsync(ConsumedMessage <Request> message) { return(Task.Factory .StartNew(() => { Console.WriteLine("[{0}]received '{1}' by '{2}' with correlation id {3}", message.ConsumerTag, message.Headers.MessageId, GetType().Name, message.Headers.CorrelationId); var exchange = _broker.DeclareDirectExchange(message.Headers .ReplyConfiguration .ExchangeName); var queue = _broker.DeclareQueue(message.Headers .ReplyConfiguration .RoutingKey); _broker.DeclareExchangeBinding(exchange, queue, message.Headers.ReplyConfiguration.RoutingKey); var outboundMessage = new OutboundMessage <Response>(new Response { BarBar = message.Content.Bar * 2 }); outboundMessage.SetCorrelationId(message.Headers.CorrelationId); _connection.PublishAsync(outboundMessage, exchange, message.Headers.ReplyConfiguration.RoutingKey); })); }
private static Queue BindQueue(IBroker broker, String queueName, Exchange exchange) { var queue = broker.DeclareQueue(queueName); broker.TryDeclareExchangeBinding(exchange, queue, RoutingKey); return(queue); }
private static Queue BindQueue(IBroker broker, String queueName, Exchange exchange) { var queue = broker.DeclareQueue(queueName); broker.TryDeclareExchangeBinding(exchange, queue, RoutingKey); return queue; }