启用secondLevelRetriesEnabled的Rebus不会停止在IFailed处理程序上重试。

huangapple go评论37阅读模式
英文:

Rebus with secondLevelRetriesEnabled enable retries doesn't stop retrying on IFailed<T> handler

问题

I'm having an issue with rebus (that I'm sure it's me the problem) and here's the issue:
我在使用Rebus时遇到了问题(我相信问题在于我自己),问题如下:

I have second level retries enabled.
我启用了二级重试。

In the normal handler I throw a FailFastException
在正常的处理程序中,我抛出一个FailFastException异常。

In the IFailed<T> handler I got the message and I do a kind of "delayed" retry (I defer 10 times with a delay of 30s)
在IFailed<T>处理程序中,我获取消息并进行一种“延迟”重试(我延迟10次,每次延迟30秒)。

After all 10 re-tries, I want to finish (aka send to error queue) and for this I'm just throwing a new exception and it "kinda" works.
在经过所有的10次延迟重试之后,我想要结束(即发送到错误队列),为此我只是抛出了一个新的异常,这个方法“有点”有效。

The issue is in the last step, when I throw the last exception, rebus still retries 5 times (default). So actually I'm retrying 10 times (defer) + 5 times (rebus default fast retry).
问题出在最后一步,当我抛出最后一个异常时,Rebus仍然进行5次重试(默认设置)。所以实际上我在进行10次延迟重试 + 5次(Rebus默认的快速重试)。

Is there any way I can only do the 10 (deferred) times? I can forward to the dead letter queue manually but... it seems hacky.
是否有办法只进行10次(延迟)重试?我可以手动转发到死信队列,但…这似乎有点繁琐。

Also, I use fleet manager, does forwarding the message to the error queue means the message will also be in the fleet manager?
另外,我使用Fleet Manager,将消息转发到错误队列是否意味着消息也会出现在Fleet Manager中?

英文:

I'm having an issue with rebus (that I'm sure it's me the problem) and here's the issue:
I have second level retries enabled.
In the normal handler I throw a FailFastException
In the IFailed<T> handler I got the message and I do a kind of "delayed" retry (I defer 10 times with a delay of 30s)
After all 10 re-tries, I want to finish (aka send to error queue) and for this I'm just throwing a new exception and it "kinda" works.

The issue is in the last step, when I throw the last exception, rebus still retries 5 times (default). So actually I'm retrying 10 times (defer) + 5 times(rebus default fast retry).

Is there any way I can only do the 10 (deferred) times? I can forward to the dead letter queue manually but... it seems hacky.

Also, I use fleet manager, does forwarding the message to the error queue means the message will also be in the fleet manager?

答案1

得分: 1

Is there any way I can only do the 10 (deferred) times? I can forward to the dead letter queue manually but... it seems hacky.

有办法只执行10次(延迟执行)吗?我可以手动转发到死信队列,但...这似乎有点巧妙。

Also, I use fleet manager, does forwarding the message to the error queue means the message will also be in the fleet manager?

另外,我使用车队管理器,将消息转发到错误队列是否意味着消息也会出现在车队管理器中?

英文:

> Is there any way I can only do the 10 (deferred) times? I can forward to the dead letter queue manually but... it seems hacky.

Yes, but it requires a little bit of manual work 🙂 you can do something like this in your 2nd level retry handler:

try
{
	await TrySomethingAlternativeAsync();
}
catch(Exception exception) 
{
	// bummer, it still fails!
	// 
	// just deadletter the message now then
	await bus.Advanced.TrandportMessage.Deadletter(exception);
}

> Also, I use fleet manager, does forwarding the message to the error queue means the message will also be in the fleet manager?

Yes 🙂

huangapple
  • 本文由 发表于 2023年2月14日 00:16:15
  • 转载请务必保留本文链接:https://go.coder-hub.com/75438494.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定