private void DoAck(BasicDeliverEventArgs basicDeliverEventArgs, SubscriptionInfo subscriptionInfo, Action<IModel, ulong> ackStrategy)
        {
            const string failedToAckMessage = "Basic ack failed because channel was closed with message {0}." +
                                              " Message remains on RabbitMQ and will be retried.";

            try
            {
                ackStrategy(subscriptionInfo.Consumer.Model, basicDeliverEventArgs.DeliveryTag);

                if (subscriptionInfo.ModelIsSingleUse)
                {
                    subscriptionInfo.Consumer.CloseModel();
                    subscriptionInfo.SubscriptionAction.ClearAction();
                }
            }
            catch (AlreadyClosedException alreadyClosedException)
            {
                logger.Info(string.Format(failedToAckMessage, alreadyClosedException.Message));
            }
            catch (IOException ioException)
            {
                logger.Info(string.Format(failedToAckMessage, ioException.Message));
            }
            finally
            {
                if (SynchronisationAction != null)
                {
                    SynchronisationAction();
                }
            }
        }
 private void HandleErrorInSubscriptionHandler(
     BasicDeliverEventArgs basicDeliverEventArgs,
     SubscriptionInfo subscriptionInfo,
     Exception exception)
 {
     logger.Error(BuildErrorMessage(basicDeliverEventArgs, exception));
     consumerErrorStrategy.HandleConsumerError(basicDeliverEventArgs, exception);
     DoAck(basicDeliverEventArgs, subscriptionInfo, ExceptionAckStrategy);
 }