• <tfoot id='Xoewj'></tfoot>
      <i id='Xoewj'><tr id='Xoewj'><dt id='Xoewj'><q id='Xoewj'><span id='Xoewj'><b id='Xoewj'><form id='Xoewj'><ins id='Xoewj'></ins><ul id='Xoewj'></ul><sub id='Xoewj'></sub></form><legend id='Xoewj'></legend><bdo id='Xoewj'><pre id='Xoewj'><center id='Xoewj'></center></pre></bdo></b><th id='Xoewj'></th></span></q></dt></tr></i><div id='Xoewj'><tfoot id='Xoewj'></tfoot><dl id='Xoewj'><fieldset id='Xoewj'></fieldset></dl></div>
      • <bdo id='Xoewj'></bdo><ul id='Xoewj'></ul>
      <legend id='Xoewj'><style id='Xoewj'><dir id='Xoewj'><q id='Xoewj'></q></dir></style></legend>
    1. <small id='Xoewj'></small><noframes id='Xoewj'>

        指定公共交通中的发布超时

        时间:2023-08-26

              <tbody id='5OTPI'></tbody>

              • <bdo id='5OTPI'></bdo><ul id='5OTPI'></ul>

                • <i id='5OTPI'><tr id='5OTPI'><dt id='5OTPI'><q id='5OTPI'><span id='5OTPI'><b id='5OTPI'><form id='5OTPI'><ins id='5OTPI'></ins><ul id='5OTPI'></ul><sub id='5OTPI'></sub></form><legend id='5OTPI'></legend><bdo id='5OTPI'><pre id='5OTPI'><center id='5OTPI'></center></pre></bdo></b><th id='5OTPI'></th></span></q></dt></tr></i><div id='5OTPI'><tfoot id='5OTPI'></tfoot><dl id='5OTPI'><fieldset id='5OTPI'></fieldset></dl></div>

                  <small id='5OTPI'></small><noframes id='5OTPI'>

                  <legend id='5OTPI'><style id='5OTPI'><dir id='5OTPI'><q id='5OTPI'></q></dir></style></legend><tfoot id='5OTPI'></tfoot>
                  本文介绍了指定公共交通中的发布超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  在使用 MassTransit 库发布消息时,是否可以指定超时值.消息代理宕机时如何处理场景.现在看来 Publish 调用无限期地等待.控制这些行为会很好.我们应该依赖取消令牌吗?超时实现可能会更好.

                  Is there a way to specify timeout value when publishing messages using the MassTransit Library. How to handle scenarios when message broker goes down. Now it seems that Publish call waits indefinitely. It would be nice to control these behavior. Should we rely on cancellation token? Timeout implementation might be better.

                  推荐答案

                  您可以将 CancellationToken 传递给 Publish.如果取消,将抛出 OperationCanceledException.如果你想使用超时,你可以创建一个带有超时的CancellationTokenSource.

                  You can pass a CancellationToken to Publish. If canceled, an OperationCanceledException will be thrown. If you want to use a timeout, you can create a CancellationTokenSource with a timeout.

                  using var source = new CancellationTokenSource(TimeSpan.FromSeconds(30));
                  
                  await bus.Publish(message, source.Token);
                  

                  这篇关于指定公共交通中的发布超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:RabbitMQ 异步支持 下一篇:在 ASP.NET Core 应用程序中设置 RabbitMQ 消费者

                  相关文章

                  最新文章

                    <tfoot id='QO8PS'></tfoot>

                        <bdo id='QO8PS'></bdo><ul id='QO8PS'></ul>
                      <i id='QO8PS'><tr id='QO8PS'><dt id='QO8PS'><q id='QO8PS'><span id='QO8PS'><b id='QO8PS'><form id='QO8PS'><ins id='QO8PS'></ins><ul id='QO8PS'></ul><sub id='QO8PS'></sub></form><legend id='QO8PS'></legend><bdo id='QO8PS'><pre id='QO8PS'><center id='QO8PS'></center></pre></bdo></b><th id='QO8PS'></th></span></q></dt></tr></i><div id='QO8PS'><tfoot id='QO8PS'></tfoot><dl id='QO8PS'><fieldset id='QO8PS'></fieldset></dl></div>
                    1. <legend id='QO8PS'><style id='QO8PS'><dir id='QO8PS'><q id='QO8PS'></q></dir></style></legend>

                      <small id='QO8PS'></small><noframes id='QO8PS'>