fedora-messaging icon indicating copy to clipboard operation
fedora-messaging copied to clipboard

Define a way for consumer callbacks to have a startup and a shutdown process

Open abompard opened this issue 3 years ago • 4 comments

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 avatar Apr 24 '23 10:04 abompard

@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 avatar Mar 13 '24 15:03 maha-sachin

@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 avatar Mar 13 '24 16:03 abompard

@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?

maha-sachin avatar Mar 13 '24 16:03 maha-sachin

Please check out other issues tagged with easyfix or good-first-issue: https://easyfix.apps.ocp.stg.fedoraproject.org/#fedora-infra

abompard avatar Mar 14 '24 10:03 abompard