-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Question: Do we need support for nested transaction? #5
Comments
@prolic prooph/event-store supports nested transactions since v4.0 but the adapter is not informed about it. The adapter only handles one transaction at the same time. Reasons: In an ideal world you would not dispatch two commands within the same transaction. Each command would be handled in its own transaction. In this case the events caused by the command are persisted on But this set up adds complexity to the stack. What if the read model projection fails? The event was persisted and cannot be rolled back. Same for sagas: What happens if the second command fails? In distributed systems you have to find answers to this questions and you need also solutions when you use different persistence mechanisms for your write and read model. But as long as you use the same persistence layer for events, sagas and your read model you want to be able to rollback every stage when something breaks during a single process (http request/response cycle) When using an RDBMS with transaction support this is relatively easy to achieve. Instead of publishing domain events after For the mongo db adapter this would mean that the Question is, do we want to support something like this? Both concepts have their drawbacks and you need to understand a lot of internals. What do you think about all that 😄 ? |
I think it's perhaps unneeded. A failing read model update could also trigger its own event. If the original event is correct, the system is able to run, the read model could not be up to date, but that is fine, as long as another process can try to re-update the read model later or handle the concrete failing event. Examples:
Thoughts? |
I like the approach. It reduces the complexity of transaction handling to allow only one transaction per command. No exceptions, no nested command dispatch. So users are forced to think about CQRS + DDD solutions for the problem. |
Great! ;) |
Extracted from #4. Asked by @prolic.
The text was updated successfully, but these errors were encountered: