Exemple #1
0
        public ActionResult Get()
        {
            return(_broker.Execute <ActionResult>((channel) =>
            {
                var queueName = "queue-create-compra";
                var data = channel.BasicGet(queueName, false);

                if (data == null)
                {
                    return new EmptyResult();
                }

                var message = Encoding.UTF8.GetString(data.Body.ToArray());
                channel.BasicAck(data.DeliveryTag, false);
                return new JsonResult(JsonSerializer.Deserialize <Compra>(message));
            }));
        }