正确处理 NServiceBus 超时

发布于 2024-09-19 09:28:04 字数 467 浏览 8 评论 0原文

NServiceBus提供了超时机制。来自 nservicebus.com

基础上的RequestTimeout方法 类告诉 NServiceBus 发送一个 消息到另一个端点,这将 持久地为我们保留时间......有一个 NServiceBus自带的流程 称为超时管理器 提供了一个基本的实现 此功能。

当时间到了,超时管理器 向 saga 发回一条消息 导致其 Timeout 方法为 使用相同的状态对象调用 本来就通过了。

正如我所看到的,即使消息已传递给接收者(例如,回复卡在某处),也有可能触发超时。

如何设计我的应用程序,以便无论消息是否到达接收者,我的应用程序都能正确运行。

NServiceBus provides a timeout mechanism. From nservicebus.com:

The RequestTimeout method on the base
class tells NServiceBus to send a
message to another endpoint which will
durably keep time for us ... There's a
process that comes with NServiceBus
called the Timeout Manager which
provides a basic implementation of
this functionality.

When time is up, the Timeout Manager
sends a message back to the saga
causing its Timeout method to be
called with the same state object
originally passed.

As I see it there is a possibility that the timeout is triggered even though the message has been delivered to the receiver (the reply got stuck somewhere for example).

How do I design my application in such a way that my application will behave correctly regardless if the message made it to the receiver or not.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

迷你仙 2024-09-26 09:28:04

如果客户端向服务器发送消息,然后请求超时,则请求的状态将被存储。如果客户端在服务器回复之前收到超时消息,那么您可以将超时返回的状态与当前状态进行比较,看看服务器是否尚未回复并决定要做什么。如果请求不再有效,您可能会忽略回复。如果是这种情况,您可能需要查看服务器消息的“TimeToBeReceived”属性。它会丢弃在指定时间内无法收到的消息。

If the Client sends a message to the Server and then requests a Timeout, the state of the request will be stored. If the Timeout message is received by the Client prior to the reply from the Server then you can compare the state returned by the Timeout to the current state and see that the Server has not replied and decide what to do. If the request is no longer valid, you might ignore the reply. If that is the case, you may want to look at the "TimeToBeReceived" attribute for the Server message. It will throw away messages it can't receive in the designated time.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文