0

In short: Out of order commands end up with out of order events, so does the ordering of the events matter in such situations?

Since we are uncertain about the order of commands when an asynchronous message queue like Rabbitmq is used for sending the commands,so we are uncertain about the order of the resulting events.

So what is the use of persisting the events as a sequence when we are unsure about their order?

What are design tips for using rabbitmq for sending commands and event store?

asked Jul 12, 2019 at 11:57

1 Answer 1

2

So what is the use of persisting the events as a sequence when we are unsure about their order?

Well, we are sure about the order of events -- they are sequenced in the order that they are written, which is determined by the order in which the commands finish processing. (If you are using a single command handler, that is equivalent to the order in which the commands arrive at the handler).

What the asynchronous message queue gives you is the ability to transport messages to a (currently) unavailable recipient. The queue itself is plumbing, with higher availability because we don't need to keep swapping it out for business reasons.

Because commands can arrive "out of order", the logic in the recipient needs to include covering that contingency (assuming it is important to the business). Distributed messaging fundamentally means you never know if you have received all of the messages that you are going to eventually; at some point you are going to need to guess that you have all of the messages, or forever be paralyzed into inaction.

Think email. You get an email from Bob, you act on it, and later you get an email from Alice that she sent earlier than the mail from Bob, but hers was delayed somewhere. Now what? You proceed as best you can and get on with it.

See also Race Conditions Don't Exist.

answered Jul 12, 2019 at 13:16
2
  • The out of order messages scenario I discussed is because of the use of an asynchronous message queue, and does not always happen in the real physical world. I wonder is there any technical solution to that? Commented Jul 12, 2019 at 15:24
  • en.wikipedia.org/wiki/Fallacies_of_distributed_computing Commented Jul 12, 2019 at 15:31

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.