cosmicpython / code

Example application code for the python architecture book
Other
2.14k stars 943 forks source link

[Question] How would you implement Flask event Listeners? #58

Open adam-mrozik opened 1 year ago

adam-mrozik commented 1 year ago

Hey,

I am looking at rebuilding some Flask services under the idea you are showcasing here.

Issue is that a lot of what we did was build on Flask event_listeners. What they do is essentially react to any changes to the data.

Do you have any proposal how to essentially be able to reuse those for SQLAlchemy prod use-case, but have them as mocks for tests?

hjwp commented 1 year ago

I don't know anything about Flask signals or event listeners i'm afraid. from you saying "react to changes to the data", i'm guessing they're actually hooked into flask-sqlalchemy or some sort of database/storage plugin?

it sounds like they're essentially doing the same job as domain events, but using some infrastructure / tools that are coupled to the db?