memphis.py icon indicating copy to clipboard operation
memphis.py copied to clipboard

stop consume functionality

Open Adarsh-jaiss opened this issue 11 months ago • 3 comments

I have created a stopConsume method with self parameter, refefered in the issue #139

def stopConsume(self):
    if self.t_consume is not None:
        self.t_consume.cancel()
        self.t_consume = None

In this code :

  • The stopConsume method is added to the Consumer class. This method will cancel the task responsible for consuming messages, effectively stopping the automatic message consumption.

  • In the __consume method, we added a condition to check whether the consumer task (t_consume) is still running. If not, it will break out of the loop, ensuring that the consumption stops when stopConsume is called.

Adarsh-jaiss avatar Aug 03 '23 06:08 Adarsh-jaiss