Why are you persisting database after send event?
iquirino opened this issue · 1 comments
iquirino commented
Hello,
I'm sorry, I am studying about DDD and CQRS.
I have to ask you: Why are you persisting database after send event?
Will the event get dispatched if the database save fails?
Should we call the "await this.accountRepository.save(account);" before calling the "account.commit();"?
Thank you!
kyhsa93 commented
@iquirino Thank you for creating the issue.
I think what you said is a better way.
This is the part I didn't think about and missed.
I only thought of Transaction and did not think of any exceptions due to order.
I think we should apply this to other command handlers as well.
I will make a correction within a few days, or if you want submit a pull request, I will review it as soon as possible.
Thank you.