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

Stop consume functionality #139

Open
Avitaltrifsik opened this issue Apr 4, 2023 · 7 comments
Open

Stop consume functionality #139

Avitaltrifsik opened this issue Apr 4, 2023 · 7 comments

Comments

@Avitaltrifsik
Copy link
Contributor

We want users to make use of the consumer.consume function, will be able to stop the automatic consumption.
So we need a new function consumer.stopConsume which will be responsible to do so.

@Avitaltrifsik Avitaltrifsik changed the title New function Stop consume functionality Apr 4, 2023
@saivythik
Copy link

@Avitaltrifsik ,
i have to make use the consumer.consume function and
create a new function named consumer.stopconsume which stop automatic consumption.
plz correct me if i am wrong.

@idanasulin2706
Copy link
Contributor

Yes exactly

@Adarsh-jaiss
Copy link
Contributor

  • Is anyone worked on this issue, if not then I would love to work to work on this issue

@rnowling-memphis
Copy link
Contributor

@Adarsh-jaiss The issue is available if you want to work on it. It would be much appreciated. Thank you :)

@Adarsh-jaiss
Copy link
Contributor

Hey @Avitaltrifsik , I have created a stopConsume method with self parameter. kindly have a look into this:

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.

@idanasulin2706
Copy link
Contributor

Hi @Adarsh-jaiss it looks like that will do the job, have you already opened a PR because I couldn't find it?

@Adarsh-jaiss
Copy link
Contributor

@idanasulinmemphis I have mentioned this issue in the pr #193

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

No branches or pull requests

5 participants