【发布时间】:2015-07-23 06:23:39
【问题描述】:
我遇到了与我尝试过的文档或搜索中找不到任何参考的重试相关的行为。本质上,如果我的处理程序处理消息的时间超过 60 秒(注意它不会引发异常),NServiceBus 会触发另一个处理程序来处理相同的消息。这意味着处理程序完成的工作(至少)运行两次(通常是 5 次,因为我将 MaxRetries 配置为 5)。
我只希望消息在确实失败时重试(即抛出异常),而不仅仅是因为它花费的时间超过一分钟。
这种行为是否符合设计?可以关闭吗? “60 秒”是否可配置?
在日志中,它看起来就像正在处理一条新消息:
2014-12-09 14:50:38,406 [13] DEBUG NServiceBus.Pipeline.BehaviorChain`1 - ChildContainerBehavior
2014-12-09 14:50:38,422 [13] DEBUG NServiceBus.Pipeline.BehaviorChain`1 - MessageHandlingLoggingBehavior
2014-12-09 14:50:38,430 [13] DEBUG NServiceBus.Unicast.Behaviors.MessageHandlingLoggingBehavior - Received message with ID 031e6070-4397-4e55-8670-a3fc00f49d7c from sender Foo
2014-12-09 14:50:38,440 [13] DEBUG NServiceBus.Pipeline.BehaviorChain`1 - ImpersonateSenderBehavior
...
2014-12-09 14:50:40,313 [13] DEBUG NServiceBus.Pipeline.BehaviorChain`1 - InvokeHandlersBehavior
2014-12-09 14:50:40,319 [13] INFO MyHandler - Running
...
...
2014-12-09 14:51:38,642 [15] DEBUG NServiceBus.Pipeline.BehaviorChain`1 - ChildContainerBehavior
2014-12-09 14:51:38,667 [15] DEBUG NServiceBus.Pipeline.BehaviorChain`1 - MessageHandlingLoggingBehavior
2014-12-09 14:51:38,678 [15] DEBUG NServiceBus.Unicast.Behaviors.MessageHandlingLoggingBehavior - Received message with ID 031e6070-4397-4e55-8670-a3fc00f49d7c from sender Foo
2014-12-09 14:51:38,686 [15] DEBUG NServiceBus.Pipeline.BehaviorChain`1 - ImpersonateSenderBehavior
...
2014-12-09 14:51:38,831 [15] DEBUG NServiceBus.Pipeline.BehaviorChain`1 - InvokeHandlersBehavior
2014-12-09 14:51:38,837 [15] INFO MyHandler - Running
【问题讨论】:
-
看看端点日志,有可能发生的事情是事务超时(默认超时为 1 分钟)并基本上抛出异常并重试消息.
-
我在日志中看到的(我在上面添加的)只是运行所有行为的管道行为链,就好像收到了一条新消息一样。与事务超时无关。
标签: nservicebus