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.

  • In this case, C will have to have a repository to sync the notifications published by A and B and correlate them. Is such feature provided by messaging systems? It is quite cumbersome to implement such thing, specially if I have many instances of A and B. – Husain Mar 16 at 10:38
  • How C stores the correlation is implementation details, It doesn't make the solution less valid. Don't expect easy solutions for lazy developers. That's not how distributed computing is taken forward. – Laiv Mar 17 at 14:19

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.