rebus.rabbitmq 3.0.0 및 rabbitmq.client 4.1.1을 사용하여 rebus 3.1.5를 사용하고 있습니다. 두 번의 최대 배달 시도로 간단한 재 시도 전략을 사용하도록 구성했습니다. 예외가 발생하는 경우에 대비해 메시지를 다시 보내고 싶습니다. 나는 거래 범위를 사용하지 않는다. 그러나 예외가 발생하면 메시지를 다시 전달하지 않습니다. (오류 대기열에도 없습니다)예외가 발생하면 Rebs 핸들러가 다시 시도하지 않습니다.
이것이 가능하지 않고 HandleMessagesInsideTransactionScope로 rebus를 구성해야하는 경우 put은 핸들러 작업을 완료 할 때까지 내 데이터베이스를 잠급니다.
대단히 감사합니다!
편집 :이 핸들러가 모습입니다 같은 :
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;
}
});
}
이 버스가 구성 방법은 다음과 같습니다
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>();
공공 작업 핸들 } \t \t \t \t 캐치 (예외 예) { \t \t \t \t \t 던지기 전, \t \t \t \t} \t \t \t}); 어이 –
VAR 버스 = Configure.With (어댑터) .Transport (t => t.UseRabbitMq (ConnectionString을, QUEUENAME)) 의 .options (B => { 나처럼 보인다; \t \t은}이 어떻게 내 손으로 .SimpleRetryStrategy (maxDeliveryAttempts : 2 secondLevelRetriesEnabled : 사실, errorQueueAddress : QUEUENAME + "_error");} ) .Timeouts (t => t.StoreInSqlServer (dbConnection 거짓 "RebusTimeouts")) .Start(); IoC.GetContainerBuilder(). RegisterInstance (버스) .As(); –
위는 제 버스 구성입니다. 두 번째 수준의 재 시도가 정상적으로 작동하지만 즉시 재 시도가 작동하지 않습니다. –