Define a way for consumer callbacks to have a startup and a shutdown process
At the moment, consumer callbacks are functions. If a class is passed, then the class is instantiated and its __call__ method is called when a message arrives. It works, but it is not optimal for consumers that need significant startup and shutdown processes.
Consider a consumer that forwards incoming messages to IRC. To be called with the very convenient fedora-messaging consume CLI, the consumer needs to be a class that will connect to the IRC network in its __init__() method. This can make testing difficult, and is not adapted to asynchronous environments. There is also no way to properly disconnect from the IRC network, as a class' __del__ method is not reliable (and not async-enabled either).
We should define methods that will be called by fedora-messaging prior and after the delivery of messages. Such methods could be named start and stop, or startup and shutdown, or setup and teardown, and the like.
@abompard , May I know this issue #285, do you think this would be a suitable issue for an Outreachy intern to take on?
@maha-sachin Not really, sorry, it's not very well defined and I need to think a bit more about the consequences and the standards we want to set.
@maha-sachin Not really, sorry, it's not very well defined and I need to think a bit more about the consequences and the standards we want to set.
@abompard, No problem at all. I understand the need for clarity and standards. May I know is there any suitable issue for an Outreachy intern to take on?
Please check out other issues tagged with easyfix or good-first-issue: https://easyfix.apps.ocp.stg.fedoraproject.org/#fedora-infra