-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
88c546c
commit 4678a2c
Showing
2 changed files
with
43 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
Welcome to Flask-SignalBus's documentation! | ||
=========================================== | ||
|
||
**Flask-SignalBus** adds to Flask-SQLAlchemy the capability to | ||
*atomically* send messages (signals) over a message bus. | ||
|
||
The Problem | ||
``````````` | ||
|
||
In microservices, the temptation to do distributed transactions pops | ||
up all the time. | ||
|
||
*Distributed transaction*: | ||
any situation where a single event results in the mutation of two | ||
separate sources of data which cannot be committed atomically | ||
|
||
One practical and popular solution is to pick one of the services to | ||
be the primary handler for some particular event. This service will | ||
handle the original event with a single commit, and then take | ||
responsibility for asynchronously communicating the secondary effects | ||
to other services via a message bus of some sort (RabbitMQ, Kafka, | ||
etc.). | ||
|
||
Thus, the processing of each "distributed" event involves three steps: | ||
|
||
1. As part of the original event transaction, one or more messages | ||
are recorded in the SQL database of the primary handler service | ||
(as rows in tables). | ||
|
||
2. The messages are sent over the message bus. | ||
|
||
3. Messages' corresponding table rows are deleted. | ||
|
||
*Flask-SignalBus* automates this process and make is less error prone. | ||
It automatically sends the recorded messages after each transaction | ||
commit (steps 2 and 3). Also, when needed, the sending of the recorded | ||
messages can be triggered explicitly with a method call, or through | ||
the Flask command line interface. | ||
|
||
You can read the docs `here`_. | ||
|
||
|
||
.. _here: https://flask-signalbus.readthedocs.io/en/latest/ |