NServiceBus 二级重试和错误队列设置

来源:互联网 发布:网络主播收入提成 编辑:程序博客网 时间:2024/06/07 03:58

在项目的App.config文件中

(1)如何设置二级重试(Second Level Retries)的参数:


<configSections>  <section name="SecondLevelRetriesConfig"            type="NServiceBus.Config.SecondLevelRetriesConfig, NServiceBus.Core"/></configSections>
以上代码把SLR的这个配置项申明出来,表示该文件中使用到了SLR配置项
<SecondLevelRetriesConfig Enabled="true" TimeIncrease="00:00:10" NumberOfRetries="3" />
以上代码是配置SLR具体参数,其中:
  • Enabled:打开或者关闭SLR。
  • TimeIncrease: 每两次重试之间的时间间隔,(对于同一个对象)
  • NumberOfRetries: 最多重复多少次

(2) 如何设置错误队列
为了让监管人员更好的看到错误,最好把所有程序的错误存放在同一个错误queue中。具体方法如下:
申明配置项:
<configSections>
    <section name="MessageForwardingInCaseOfFaultConfig" type="NServiceBus.Config.MessageForwardingInCaseOfFaultConfig, NServiceBus.Core" />
  </configSections>
设置配置项参数:
  <MessageForwardingInCaseOfFaultConfig ErrorQueue="error" />
1 0
原创粉丝点击