Use case
Server A: django webapp, database
Server B: airflow
These 2 servers’ apps will work together using database as single source of truth.
Server A (django) will be responsible for creating the database records
Server B (airflow) will update the database records directly once certain job is completed
They are hosted on different servers as I want to split webapp (A) from data processing (B). Easier to scale.
Challenge
-
I can’t use django model signals (Signals | Django documentation | Django) such as
post_save
as Server B (airflow) update database record directly and not using django ORM -
I don’t think django request/response signals (Signals | Django documentation | Django) will be useful in this use case right?
Solution
I think the solution is to create a fastapi in server A.
Airflow will call server A’s fastapi once the job is completed instead of updating database record directly. Fastapi then call django ORM to update object, so that django signal receiver can execute the next action.
Question
Is there a better solution?
Signal receiver can’t work like an API right?