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

Add a built-in "event hook" for sending messages based on app events #460

Open
bowlofeggs opened this issue Aug 8, 2017 · 0 comments
Open

Comments

@bowlofeggs
Copy link

bowlofeggs commented Aug 8, 2017

@jeremycline wrote a useful feature for Bodhi where he queued up fedmsgs that the application wanted to send until the database commit was issued. Once the commit completes, Bodhi then issues the actual calls to fedmsg that send the messages.

I think we could abstract that idea and add a feature into fedmsg that does some of this pattern so all apps can benefit from the pattern. It would be necessary for fedmsg to provide some way for the app to register an event handler (such as a database commit in the case of Bodhi, but we'd want it to be more generic I'd think), and some way for fedmsg to hold messages that the app wants to send until the event fires.

Idea: it could be cool if the API for fedmsg to hold messages until the event was just the same API that is used to send messages. Whether the messages get immediately sent or held waiting for the event would depend on whether an event listener was registered with fedmsg or not. This could be cool because it would make it pretty easy for existing apps to adopt this new pattern - they'd just need to call the event registration API and bam!

The code in Bodhi that does this is here: https://github.com/fedora-infra/bodhi/blob/2.9.0/bodhi/server/notifications.py#L55-L123

@bowlofeggs bowlofeggs changed the title Add a built-in "commit hook" for sending messages based on app events Add a built-in "event hook" for sending messages based on app events Aug 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant