0
votes

Background:

I have a publisher with 2 subscribers on GCP pub/sub, both the subscribers run a NodeJS code & acknowledge once the process is done.

Issues:

  1. How can I know which subscriber has ack the message?
  2. Say I have only 1 subscriber and I have sent 10 messages at once (in parallel) and 2 have failed, how can I know which 2 messages were failed? Is there any mapping between ackId and message sent on GCP pub/sub?
1

1 Answers

1
votes

The acknowledgement sent when a subscriber receives a message is separate from the acknowledgement sent to the publisher when Cloud Pub/Sub saves the message and makes it available to subscriptions. This is by design, Pub/Sub wants the senders of messages to be decoupled from the receivers of messages.

When publishing a message fails it is automatically retried unless the error doesn't warrant a retry. The Nodejs client library supports custom retry settings and the documentation gives an example to know which messages have been published.