mikehadlow/EasyNetQ — pull request #152 by jamescrowley (2014-02-03 16:31:49+00:00)
Title: [Breaking change] Refactor consumer error strategy 

A breaking change that makes HandleConsumerError return the PostExceptionAckStrategy rather than a separate method call.

The logic being that if you're changing the Ack strategy, it's probably decided within HandleConsumerError. We currently have code like this in our implementation of IConsumerErrorStrategy

public void HandleConsumerError(ConsumerExecutionContext context, Exception exception)
{
_shouldNack = someLogicHere
if (!_shouldNack)
{
_strategy.HandleConsumerError(context, exception);
}
}

public PostExceptionAckStrategy PostExceptionAckStrategy()
{
if (_shouldNack) // hack because we can't return this from HandleConsumerError
return EasyNetQ.Consumer.PostExceptionAckStrategy.ShouldNackWithRequeue;
return _strategy.PostExceptionAckStrategy();
}