Google Pub/Sub emulator: Get unacknowledged messages?

Viewed 288

I'm using version 368.0.0 of the Google Pub/Sub emulator. I like to get the currently unacknowledged messages - at least their number. Preferably also their content and other meta-data.

How do I do that?

I can successfully ran requests to e.g. http://localhost:8123/v1/projects/my-project/topics, but I cannot find any endpoint for listing unacknowledged messages on https://cloud.google.com/pubsub/docs/reference/rest.

According to the answer on this question I'd have to use a different API. However, I did not find out how to access that API on the emulator

1 Answers

The Cloud Pub/Sub emulator does not support a way to get the number of undelivered or unacknowledged messages in a subscription.

In the real, production version of Cloud Pub/Sub, you are able to look at the pubsub.googleapis.com/subscription/num_undelivered_messages in Stackdriver. Since Stackdriver has an API, you can retrieve this number programmatically. This is what the answer for this question was referring to.

Related