🎄 Happy Holidays! 🥳
Most of Solace is closed December 24–January 1 so our employees can spend time with their families. We will re-open Thursday, January 2, 2024. Please expect slower response times during this period and open a support ticket for anything needing immediate assistance.
Happy Holidays!
Please note: most of Solace is closed December 25–January 2, and will re-open Tuesday, January 3, 2023.
How to gracefully stop a consumer ?
looking for way to stop and resume a consumer with out losing the messages in the queue.
Comments
-
Hi @nbommidi, that's kind of the point of PubSub+ :-)
When you say "stop and resume a consumer" do you mean the application as a whole or just the application interface to the queue?
Our APIs have a mechanism for stopping queue consumption without disconnecting. For instance, in the Java API you can call pause() and then resume() on the ReceiverFlowControlInterface. This allows you to safely control the flow of messages to the application.
If you would like to shut down the application and then restart it, the broker keeps track of the acknowledgements you've sent on the messages. It is important to control when you send an acknowledgement: only acknowledge a message once you've completely finished with it, so use per-message acknowledgements and not automatic acknowledgements.
I hope that helps?
0 -
Hi @nbommidi,
The Cloud Stream framework itself actually provides support for this at the binding level. But, the Cloud Stream binder for your broker must support this functionality. The current release of the Solace Binder does not, however an enhancement to the Solace binder is already in the works and is planned to be in the next release, which is coming in March. You can actually see the PR [here](https://github.com/SolaceProducts/solace-spring-cloud/pull/123).
You can find the framework docs for how to use it programmatically or via actuator in the [Binding visualization and control](https://docs.spring.io/spring-cloud-stream/docs/3.2.1/reference/html/spring-cloud-stream.html#binding_visualization_control) section of their reference guide.
Hope that helps!
0