Relative Content

Tag Archive for spring-bootgoogle-cloud-platformgoogle-cloud-pubsub

How to pull pub/sub messages serially

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