Hi I am using pub/sub for one Job, where my requirement is that subscriber should not ack the message immediately.
I am using below piece of code
ProjectSubscriptionName subscriptionName = ProjectSubscriptionName.of(projectId, subscriptionId);
subscriber = Subscriber.newBuilder(subscriptionName, messageReceiver).build();
subscriber.startAsync().awaitRunning();
subscriber.awaitTerminated();
Code reference Link :https://cloud.google.com/pubsub/docs/publish-receive-messages-client-library#receive_messages
But in Response i am seeing that its polling the same message from the queue as there is no ack() happened for the message.
Is there a way to handle this scenario ?
Tried : I tried using the subscriber.isRunning(); method. If this method is running don’t ack the message. But this is also not working.
Expected: It should not poll in between if there is no ack().
ankita ojha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.