【问题标题】:What happens in a NServiceBus Saga when the IAmStartedBy Message comes after the IHandle Message?当 IAmStartedBy 消息出现在 IHandle 消息之后时,NServiceBus Saga 会发生什么?
【发布时间】:2011-02-27 04:17:57
【问题描述】:

我有一个看起来像这样的NServiceBus Saga

public class MySaga : Saga<MySagaData>,
                                IAmStartedByMessages<MyStartMessage>,
                                IHandleMessages<OtherMessage>

但是消息可能会乱序。那么当 IAmStartedBy 消息出现在 IHandle 消息之后时会发生什么? OtherMessage 将没有 SagaData。 NServiceBus 会吞下消息还是稍后尝试重新处理?

【问题讨论】:

    标签: .net soa nservicebus


    【解决方案1】:

    NServiceBus 将无法为 OtherMessage 找到活动的 saga,重试配置的次数,然后将消息放入错误队列中。重试可能会延迟足够长的时间以使 MyStartMessage 到达。为什么 OtherMessage 也无法启动传奇? (你可以有多个消息可以开始一个 saga)

    【讨论】:

    • 安德烈亚斯。这是预期的答案。我想避免使用多个 IAmStartedByMessage,因为这会使每个处理程序的代码复杂化。
    • Sagas 的一个使用领域是处理像您这样的情况,即消息可能无序到达,因此我不会担心有多个 IAmStartedBy。祝你好运!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-03
    • 1970-01-01
    • 2017-07-11
    • 2016-09-28
    • 1970-01-01
    相关资源
    最近更新 更多