How to gracefully stop a consumer ?

looking for way to stop and resume a consumer with out losing the messages in the queue.

Comments

  • TomF
    TomF Member, Employee Posts: 412 Solace Employee

    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?

  • nbommidi
    nbommidi Member Posts: 9

    Hi @TomF

    Thanks for the quick response. Actually i am using spring cloud stream framework. I didn't find an option to use the pause/resume/start/stop apis

  • TomF
    TomF Member, Employee Posts: 412 Solace Employee

    Hmm, I'm no sping expert. @marc ?

  • marc
    marc Member, Administrator, Moderator, Employee Posts: 956 admin

    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!