use middleware to intercept event handlers (global event, database management, ...)#471
Merged
ramedina86 merged 7 commits intowriter:devfrom Jun 24, 2024
Conversation
…gement, ...) * refact: build fixture to init session * refact: add load ability on setup_app_runner
…gement, ...) * refact: extract execute handler
…gement, ...) * feat: implement middleware execution
…gement, ...) * feat: implement event type in context
ramedina86
reviewed
Jun 21, 2024
192ea64 to
13ac109
Compare
FabienArcellier
commented
Jun 24, 2024
FabienArcellier
commented
Jun 24, 2024
FabienArcellier
commented
Jun 24, 2024
13ac109 to
b1a1bed
Compare
FabienArcellier
commented
Jun 24, 2024
FabienArcellier
commented
Jun 24, 2024
…gement, ...) * feat: use pattern to handle exceptions * feat: allow middleware without yield
6c854f2 to
76c8781
Compare
…gement, ...) * feat: use pattern to handle exceptions * feat: allow middleware without yield * docs: describe the implementation of middlewares
76c8781 to
b7caf3d
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements the concept of middleware. Middleware is a function that intercepts all events. You can use it to implement session management for a database, code an extension to streamsync which globally modifies the operation of certain events, ...
Usecase
middleware facilitates cross-functional operations such as database transaction management. Opening a session at the start of a query is a pattern that improves the use of a database. The session links the transaction to the request. If processing fails, the transaction is rolled back. If it succeeds, the transaction is successful.
middleware facilitates cross-functional operations such as exception tracking.