Esempio n. 1
0
        public IBasicGetResult Get(IQueue queue)
        {
            Preconditions.CheckNotNull(queue, "queue");

            var result = clientCommandDispatcher.Invoke(x => x.BasicGet(queue.Name, true));

            if (result == null)
            {
                return(null);
            }
            var getResult = new BasicGetResult(
                result.Body,
                new MessageProperties(result.BasicProperties),
                new MessageReceivedInfo(
                    "",
                    result.DeliveryTag,
                    result.Redelivered,
                    result.Exchange,
                    result.RoutingKey,
                    queue.Name
                    )
                );

            logger.DebugWrite("Message Get from queue '{0}'", queue.Name);

            return(getResult);
        }
Esempio n. 2
0
        public IBasicGetResult Get(IQueue queue)
        {
            Preconditions.CheckNotNull(queue, "queue");

            var result = clientCommandDispatcher.Invoke(x => x.BasicGet(queue.Name, true));

            if (result == null)
            {
                return(null);
            }

            var getResult = new BasicGetResult(
                result.Body.ToArray(),
                new MessageProperties(result.BasicProperties),
                new MessageReceivedInfo(
                    "",
                    result.DeliveryTag,
                    result.Redelivered,
                    result.Exchange,
                    result.RoutingKey,
                    queue.Name
                    )
                );

            if (logger.IsDebugEnabled())
            {
                logger.DebugFormat("Got message from queue {queue}", queue.Name);
            }

            return(getResult);
        }