I'm using rebus 3.1.5 with rebus.rabbitmq 3.0.0, and rabbitmq.client 4.1.1. I have configured to use simple retry strategy with 2 max delivery attempts. I would like to retry the message in case when an exception is thrown. I don't use the transaction scope. But when an exception is thrown I don't get the message re-delivered again(it is not even in the error queue)
If this is not possible and if I need to configure rebus with HandleMessagesInsideTransactionScope, does it going to put locks my database until I complete the handler work?
thank you very much!
EDIT: This is what the handler looks like:
public Task Handle(SetCreditInfoCommand command)
{
return Task.Run(() => {
var loanApplication = _loanApplicationRepository.Get(command.LoanApplicationId);
try {
//something that throws an exception here
}
catch(Exception ex)
{
throw ex;
}
});
}
and this is how the bus is configured:
var bus = Configure.With(adapter)
.Transport(t => t.UseRabbitMq(connectionString, queueName))
.Options(b => b.SimpleRetryStrategy(
maxDeliveryAttempts: 2,
secondLevelRetriesEnabled: true,
errorQueueAddress: queueName + "_error"
))
.Timeouts(t => t.StoreInSqlServer(dbConnection, "RebusTimeouts", false))
.Start();
IoC.GetContainerBuilder().RegisterInstance(bus).As<IBus>();