質問

I am running into this issue:

Suppose that there are two independent services, A and B, and both process messages from C.

Suppose that I have a service X that needs to know if a message m from C was processed by both A and B. What are the reasonable patterns to design such thing? How can I sync notifications from both A and B to tell X that A and B are done with m?

役に立ちましたか?

解決

Have C give m a unique identifier. That way when A and B tell X they are done with m12 X won't get confused and match A.m12 with B.m11. Then you just need to be sure that X knows A and B are all you're expecting to hear from.

If C makes it's unique identifier sequential you can even put these ms back into their original order. But that means you can only have one C.

The CAP theorem might be worth studying so you'll understand the limitations of distributed systems like this.

他のヒント

By having A and B publish an “I'm done” notification somewhere, to which X can subscribe. The X service will need a database to hold notifications that were only processed by one but not both services, until the second confirmation also arrives.

ライセンス: CC-BY-SA帰属
所属していません softwareengineering.stackexchange
scroll top