How to implement a saga using a scatter/Gather pattern In MassTransit 3.0

后端 未结 3 1471
既然无缘
既然无缘 2021-02-03 18:00

Jimmy Boagard describes a McDonalds fast food chain here comparing it to a scatter gather pattern.

Workflow image stolen from above article:

Initial Im

3条回答
  •  北恋
    北恋 (楼主)
    2021-02-03 18:54

    The problem with kicking back finished events to the saga is that it creates contention on a shared resource (i.e the saga state).

    Jim has another post that came after the one you referenced that outlines the issue and solution. Of course, he's specifically talking about NServiceBus, but the problem and concepts are the same.

    https://lostechies.com/jimmybogard/2014/02/27/reducing-nservicebus-saga-load/

    Create an external storage. Put in a record for each work item. Let each workers set their own work to completed while the saga effectively polls using delayed messaging to see if all work is done.

    Then you are still doing scatter-gather, but the "aggregator" has been replaced by the process manager pattern to reduce contention.

提交回复
热议问题