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

Cancel Consumer and Restart #415

Closed
rphansen91 opened this issue Apr 7, 2022 · 4 comments
Closed

Cancel Consumer and Restart #415

rphansen91 opened this issue Apr 7, 2022 · 4 comments
Labels

Comments

@rphansen91
Copy link
Contributor

rphansen91 commented Apr 7, 2022

Issue
Currently it is possible to cancel a consumer, but their is not clear way to restart the consumer.

Reason
When dependencies of a Microservice are offline it is beneficial to stop the consumer and only restart when work is ready to be continued. This saves a lot of rabbit bandwidth not needing to deliver nack requeue over and over until the consumer is ready.

Solution
Maintain a list of the consumer options so that the canceled consumer can be restarted

rphansen91 added a commit to rphansen91/nestjs that referenced this issue Apr 7, 2022
When dependencies of a Microservice are offline it is beneficial to stop the consumer and only
restart when work is ready to be continued. This saves a lot of rabbit bandwidth not needing to
deliver nack requeue over and over until the consumer is ready.

fix golevelup#415
@craigotis
Copy link
Contributor

@underfisk This feature seems to meet one of our service needs - but I'm finding it hard to retrieve the ConsumerTag created once a subscriber is established. The AmqpConnection.createSubscriber() method returns Promise<void>, so it's unclear what we're supposed to pass to the cancel/resume functions to make use of this. 🤔

@underfisk
Copy link
Contributor

@craigotis Would you be down to have a PR to fix this issue?

@craigotis
Copy link
Contributor

craigotis commented Jul 21, 2022

@underfisk I'm happy to look into it - though it seems the subscription is created in the addSetup() callback for the ChannelWrapper from this project, so it would potentially need to be implemented as an optional callback parameter in the createSubscriber() function.

Before I go that route though, am I missing something? How was this cancel/restart implementation intended to be used?

Edit: It might look something like this: #472

@underfisk
Copy link
Contributor

@craigotis Your PR looks good to me but i would advocate adding some test coverage so that we can safely track whether its properly working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants