Do we need a combination of synchronous and asynchronous handler commands in CQRS?

  • The user is registered on our website and is registered. RegsiterUserCommand is sent to the asynchronous command handler.
  • The user wants to change his address, but RegisterUserCommand has not yet been processed. There is no user record in the system.

Is this the case for synchronous command handlers? A user record will be created before user authentication. Or should I revise the requirement for authentic users after registration? Users will not be able to access the site until their account is created. If users do not immediately gain access to the system, you may lose your ability to use it.

Is a combination of synchronous and asynchronous handler commands generally known in the CQRS system?

+6
cqrs
source share
1 answer

Everything works for me in async . To keep things simple, queues are FIFOs; plus there is one processing flow for each section. In this way, commands are always processed in the sending order . In addition, we still have scalability, since the flow per partition can simply be turned into a machine per partition without the need to redo the entire solution.

There are several cases where we may need synchronous processing (in my case, the example will be the initial registration of the user, since we need to check several things on the server before allowing him to continue). In this case, after sending the command to the user, "wait a few seconds until your registration is processed." As soon as the registration is confirmed (or not completed), the user will automatically go to the next screen. This is trivial to do with AJAX in the web interface. Desktop interfaces are even simpler.

+8
source share

All Articles