M
M
Maxim2019-07-30 10:43:47
Software design
Maxim, 2019-07-30 10:43:47

CQRS. How to display the created record?

Hello. There is a question-clarification on the CQRS pattern. It says that the team should not give anything away. The command should only execute. However, there are situations when, for example, when creating an entity and saving it in the database, we need to redirect to the created record.
To create, we send the CreateConmand command, which calls the Handler with the handle method. However, in this case, the record created by the command, according to all the rules of the pattern, should not return anything. Then the question arises, how do we get the data of the created record, to redirect to it after creation?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Shumov, 2019-07-30
@myks92

The CQRS pattern is not suitable for synchronous operations. It only exists in the asynchronous world, and the only thing you can get is the job (command) ID. Depending on the type of communication between systems, there are 2 options:
- request the execution result and data on it all the way
- have a reverse signal channel

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question