I have an application that can be reduced/simplify to this flow:
- user sends request to app A
- app A inserts info about the request and user into DB ( marked as "B in progress" and "C in progress")
- app A pushes the data into queue and returns to user
- app B retrieves data from queue and process it
- app B finishes processing the data and marks record in DB as "B done"
- app C retrieves data from queue and process it
- app C finishes processing the data and marks record in DB as "C done"
In other words, user sends request to app, app saves the record to the database and send it to queue, app B and C takes request from queue and process it ( each app does different thing but requires data from request ) and when they are done i want to mark the request in db as done for both APP.
This can be achieved, if all apps share DB. However sharing the DB like this between microservices is considered anti-pattern.
What are some design patterns to solve this? Am i really left with only option - make app A expose rest API and call the endpoint from app B and C to update the row in DB?
Thanks for help!