0
votes

We use Spring Cloud Stream(version 3.0.7) StreamListener to consume from Google cloud PubSub subscription 'A.SUB' from topic 'A'. We have a requirement to pause consumption from PubSub, I see below options in the order of preference, I don't have exact idea on how to achieve options 1 and 2. Can someone please share thoughts on these?

  1. Add another Pubsub Topic 'B' and publish 'Pause' event message to pause or 'Resume' event message to resume, somehow stop/start poller on subscription 'A.SUB' on seeing 'pause/resume' Is there any way to achieve this?

  2. Pause the subscription based on time window say between 12AM to 6AM? is there a way to specify some CRON expression?

  3. Consume messages from 'A.SUB' and send nack between 12AM and 6AM

@StreamListener("A.SUB") public void consume(Message message) { }

1

1 Answers

0
votes

Note: StreamListener and the entire annotation-based configuration model has been deprecated. We've fully migrated to functional programming model which is much simpler.

With regard to pausing, you can accomplish it with actuator and binding endpoints (e.g., stop, start, pause, resume) exposed by s-c-stream. You can get more info here.