Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event bus Metadata #1429

Conversation

burdettadam
Copy link
Contributor

This pr adds metadata to the event passed to an event handler. While writing a queue plugin that subscribes to events on the event bus a limitation of knowing what regular expression triggered the handler being called was identified. The event bus will call multiple handlers that match the subscribed regular expression. Currently, inside the handler, we must discover what regular expression triggered the event handler. The addition of metadata with the matched pattern in an event simplifies required logic in handlers that is error-prone.

Changes:

  • event_bus.py
    • added new EventMetaData and EventWithMetaData classes to add needed context to events

dbluhm and others added 3 commits September 29, 2021 13:55
This makes it possible to detect which pattern triggered an event
handler.

Signed-off-by: Daniel Bluhm <[email protected]>
This enables subscribers to unsubscribe themselves while being executed.

Signed-off-by: Daniel Bluhm <[email protected]>
@codecov-commenter
Copy link

Codecov Report

Merging #1429 (2d4ff9a) into main (59bc646) will decrease coverage by 0.00%.
The diff coverage is 95.45%.

@@            Coverage Diff             @@
##             main    #1429      +/-   ##
==========================================
- Coverage   95.32%   95.32%   -0.01%     
==========================================
  Files         483      483              
  Lines       29366    29384      +18     
==========================================
+ Hits        27994    28011      +17     
- Misses       1372     1373       +1     

Copy link
Contributor

@ianco ianco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@ianco ianco merged commit 7fe1bf3 into openwallet-foundation:main Sep 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants