2
I’m a beginner in DDD and came across a situation involving the rule of not modifying more than 1 Aggregate in the same transaction, using Domain Events to resolve changes in other Regattas. (see Effective Agregate Design).
The situation is as follows: The user schedules the transfer of a patient to another unit. When the transfer time comes, the user selects it in a list and clicks 'start'. But this action entails changes in three regattas (process raised with the customer):
Download: is marked as started. ex: transfer.Start();
Patient: is marked as in transfer. ex: patient.Marcarcomoemtransference();
Unit: you must reserve a position for the patient who is now to come. ex: unit.Reservarvaga(patient);
Once the transfer is started, a Transfer event is issued. Also at this time the team is authorized to start it. But if for some reason, the team initiates the transfer, but there is an error in treating the Transference event initiated, for example, by changing the patient’s status or booking a vacancy at the destination, how should I deal with this situation, since the team may already be in the middle of the transfer?
Remembering that I am following the rule of a transaction by Agregate.