Command Request Request Retry Acknowledgment

Therefore, I like the basic concept of CQS, where you can have a command that writes to one database and that updates the query database from which you are reading.

However, consider the scenario in which you enter data and want to prevent duplicates.

Using the new employee data entry, register the employee register as an example, working through a bunch of application forms to indicate details of new employees:

  • Take the top sheet.
  • Enter the username and unique payroll number in the user interface.
  • Submit.
  • Put the paper in the “completed pile”.
  • Repeat

No matter how you now allow the user to enter the same payroll number again, for example, if they are distracted and cannot remember if they were already entered with the key, and the “message” does not have all the way back to the db request for the user to search ?

+3
source share
4 answers

First, you can easily use the local cache to make sure that the immediate user is not reusing the same numbers again. It is easy enough.

But in fact, this does not stop the fact that by mistake two people can simultaneously use the same critical piece of data. As someone else said, although this is outside of CQRS. This can happen in almost any architecture.

, CQRS , - , . :

  • , . , . , , -, , .

  • , , . - , . ( ).

+1

- - , . , CQRS .

+1

  • , ( R, , ), , false , . , "" R
  • .
  • Submit.
  • " ".
  • .

.

0

Could you keep track of the list of already entered employee / payroll number combinations on the client? If it is a web client, it can be a cookie if it is a thick client, then memory or another. When they first log in, clear the list and start again.

0
source

Source: https://habr.com/ru/post/1744135/


All Articles