p13rr0m
p13rr0m

Reputation: 1297

PubSub Lite: Acknowledge all messages currently in backlog

How can I acknowledge all messages that are currently in the backlog for Google PubSub Lite subscription. I tried using

gcloud pubsub lite-subscriptions ack-up-to SUBSCRIPTION \
  --location LOCATION --partition PARTITION --offset OFFSET --project PROJECT

but I don't know how to set the offset accordingly.

Upvotes: 1

Views: 394

Answers (1)

Raul Saucedo
Raul Saucedo

Reputation: 1780

To receive messages from a Lite subscription, request messages from the Lite subscription. The client library automatically connects to the partitions in the Lite topic attached to the Lite subscription. If more than one subscriber client is instantiated, messages will be distributed across all clients. The number of partitions in the topic determines the maximum number of subscriber clients that can simultaneously connect to a subscription. You can see more documentation and examples.

You can see these example to receive messages from Lite subscriptions:

gcloud pubsub lite-subscriptions subscribe SUBSCRIPTION_ID \
    --location=LITE_LOCATION \
    --auto-ack

But if you want to subscribe to a Pub/Sub Lite subscription and automatically acknowledge messages, you can see this example:

gcloud pubsub lite-subscriptions subscribe mysubscription --location=us-central1-a --auto-ack

To subscribe to specific partitions in a subscription, this example:

gcloud pubsub lite-subscriptions subscribe mysubscription --location=us-central1-a --partitions=0,1,2

You can see more documentation about these examples.

Upvotes: 0

Related Questions