-
Notifications
You must be signed in to change notification settings - Fork 400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add docs on publishing messages in transactions with help of Forwarder component #261
Conversation
Probably not a docs problem, but when using example as stupid copy&paste on postgresql it produces error: Probably escaping problem as you can create table with dashes on postgres when properly escaped :) |
+++ | ||
|
||
## Publishing messages in transactions (and why we should care) | ||
While working with an event-driven application, you may in some point need to store an application state and publish a message |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be good to add tl;dr a problem statement in the first paragraph. Just to ensure that reader will instantly know what is the problem. If he will not find it in the first paragraph, it's a high chance that he will not read it further. Later we can go into the details and example 😉
It may be worth mentioning that we are avoiding two phrase commit + some diagram. (bonus point for diagram in .svg
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made the first paragraph focused on a problem and its solution - the Forwarder. :P svg diagram explaining how the component works added as well.
mechanism which happens to be implemented by most of the databases in today's world. One of them is MySQL used in our | ||
example. | ||
|
||
In order to commit both storing data and emitting an event in one transaction, we'd have to be able to publish our |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO it would be good to put this and the next paragraph on the top: just to let know the reader what this component gives to him. If it will be here, it's a big chance that he will not read it 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above.
While working with an event-driven application, you may in some point need to store an application state and publish a message | ||
telling the rest of the system about what just happened. As it may look trivial at a first glance, it could become | ||
a bit tricky if we consider what can go wrong in case we won't pay enough attention to details. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be cool to link here to watermill.io component docs 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Linked to the component source code.
|
||
This example presents a solution to this problem: saving events in transaction along with persisting application state. | ||
It also compares two other approaches which lack transactional publishing therefore expose application to a risk | ||
of inconsistency across the system. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some diagram may be nice here 😉 miro works pretty well for diagrams, draw.io as well. It could be added in watermill.io as well 😉
Thanks for info. I've changed the topic name to not include dashes to make it simpler. :) |
No description provided.