private void Receive(MessageReceiveProperties messageContext)
        {
            using (var channel = connectionProvider.Open(this.ProtocolName, inputAddress, true))
            {
                var consumer = new QueueingBasicConsumer(channel);

                channel.BasicConsume(inputAddress.QueueName, false, consumer);

                var delivery = consumer.Receive(receiveTimeout);
                if (delivery != null)
                {
                    try
                    {
                        log.Debug("Receiving from " + inputAddress);
                        DeliverMessage(channel, messageContext, delivery);
                    }
                    catch (AbortHandlingCurrentMessageException)
                    {
                        return;
                    }
                    catch
                    {
                        //IncrementFailuresForMessage(messageContext.MessageId);
                        MoveToPoison(delivery);
                        OnFailedMessageProcessing();
                        channel.BasicAck(delivery.DeliveryTag, false);
                    }
                }
            }
        }
Exemple #2
0
        private void Receive(MessageReceiveProperties messageContext)
        {
            using (var connection = connectionProvider.Open(this.ProtocolName, inputAddress.Broker, true))
            {
                var channel  = connection.Model();
                var consumer = new QueueingBasicConsumer(channel);

                channel.BasicConsume(inputAddress.QueueName, SendAcknowledgement, consumer);

                var delivery = consumer.Receive(receiveTimeout);
                if (delivery != null)
                {
                    log.Debug("Receiving from " + inputAddress);
                    DeliverMessage(channel, messageContext, delivery);
                }
            }
        }