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?
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?
Pause the subscription based on time window say between 12AM to 6AM? is there a way to specify some CRON expression?
Consume messages from 'A.SUB' and send nack between 12AM and 6AM
@StreamListener("A.SUB") public void consume(Message message) { }