public string MakePayment(CardPayment payment)
        {
            var corrId = Guid.NewGuid().ToString();
            var props = _channel.CreateBasicProperties();
            props.ReplyTo = _replyQueueName;
            props.CorrelationId = corrId;

            _channel.BasicPublish("", "rpc_queue", props, payment.Serialize());

            while (true)
            {
                var ea = _consumer.Queue.Dequeue();

                if (ea.BasicProperties.CorrelationId != corrId) continue;

                var authCode = Encoding.UTF8.GetString(ea.Body);                    
                return authCode;
            }
        }
Пример #2
0
 public void SendPayment(CardPayment payment)
 {
     SendMessage(payment.Serialize(), "payment.card");
     Console.WriteLine(" Payment Sent {0}, £{1}", payment.CardNumber, 
         payment.Amount);
 }