简体   繁体   English

NServiceBus 4.4.2如何在配置中设置TimeoutPersisterReceiver时间跨度

[英]NServiceBus 4.4.2 how do i set the TimeoutPersisterReceiver timespan in config

How do I increase the timespan of the TimeoutPersisterReceiver ? 如何增加TimeoutPersisterReceiver的时间跨度? it currently retries for ~1min after arming before firing. 目前,它在开火前重试约1分钟。 I have looked in the documentation but cannot see a config setting for it. 我已经看过文档,但是看不到它的配置设置。

We have been having some network issues that prevented a service from talking to the database causing the RepeatedFailuresOverTimeCircuitBreaker to arm itself. 我们一直遇到一些网络问题,这些问题阻止了服务与数据库进行通信,从而导致RepeatedFailuresOverTimeCircuitBreaker武装起来。

 INFO  NServiceBus.CircuitBreakers.RepeatedFailuresOverTimeCircuitBreaker [(null)] - The circuit breaker for TimeoutStorageConnectivity is now in the armed state

The database will eventually come back online but by the time it does the circuit breaker has been fired and the Bus has been disposed. 该数据库最终将重新联机,但是到此时断路器已被触发并且总线已被处置。 I need to increase the time span of the NServiceBus.Timeout.Hosting.Windows.TimeoutPersisterReceiver . 我需要增加NServiceBus.Timeout.Hosting.Windows.TimeoutPersisterReceiver的时间跨度。

NServiceBus.CircuitBreakers.RepeatedFailuresOverTimeCircuitBreaker [(null)] - The circuit breaker for TimeoutStorageConnectivity will now be triggered
FATAL NServiceBus [(null)] - Repeated failures when fetching timeouts from storage, endpoint will be terminated.

Circuit breaker behavior 断路器行为

After researching the code it seems that you would be able to configure the timeout poll interval via TimeoutPersisterReceiver.SecondsToSleepBetweenPolls but that does not really matter. 在研究了代码之后,您似乎可以通过TimeoutPersisterReceiver.SecondsToSleepBetweenPolls配置超时轮询间隔,但这并不重要。

The embedded circuit breaker configuration cannot be adjusted. 嵌入式断路器配置无法调整。 If an error occurs it is armed and if no successful poll succeeds within 2 minutes the circuit breaker action will be triggered which is calling raising a critical error. 如果发生错误,则进行布防 ,如果在2分钟内没有成功轮询成功,则将触发断路器动作,这将引发严重错误。

Increasing the poll interval will not help here. 增大轮询间隔将无济于事。 If you would make the poll interval more than 2 minutes the circuit breaker will always be armed thus trigger the action. 如果将轮询间隔设置为2分钟以上,则断路器将始终处于布防状态,从而触发操作。

There is nothing that you can do unfortunately except building your own version that removes the circuit breaker completely. 不幸的是,除了构建自己的版本以完全移除断路器之外,您什么都不能做。

This behavior can result in issues when your database server does a fail-over. 当您的数据库服务器执行故障转移时,此行为可能导致问题。

Critical error handling 严重错误处理

The only possible solution to tackle this condition is by hooking into the critical error handler. 解决这种情况的唯一可能的解决方案是挂接到关键错误处理程序。 Then you know such issue occurs and can do a application shutdown as I suspect that you are currently self-hosting. 然后您知道会发生此类问题,并且由于我怀疑您当前正在自托管,因此可以关闭应用程序。

You can also try to create a whole new bus instance and 'swap' the broken one with the fresh one but that is a pretty daunting task and I would recommend to just exit your application . 您也可以尝试创建一个全新的总线实例,并用新的总线实例“交换”损坏的总线实例,但这是一项艰巨的任务,我建议您退出应用程序

You can try to configure it in a class that implements IWantToRunWhenBusStartsAndStops and use the SecondsToSleepBetweenPolls property of the TimeoutPersisterReceiver. 您可以尝试在实现IWantToRunWhenBusStartsAndStops的类中配置它,并使用TimeoutPersisterReceiver的SecondsToSleepBetweenPolls属性。

However, I would add that public access to this configuration option was removed in later versions, and I'm not 100% sure why. 但是,我要补充一点是,在更高版本中已删除了对此配置选项的公共访问权,而且我不确定100%为什么。 There may be dragons. 可能有龙。 See http://bit.ly/1ToyOHb (GitHub). 参见http://bit.ly/1ToyOHb(GitHub )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM