Search code examples
google-cloud-platformgoogle-cloud-pubsub

tracing GCP PubSub MessageID


So after publishing to a pubsub topic I get response with message ID that have been published:

{
  "messageIds": [
    "6113243608857025"
  ]
}

How would trace what happened with this messageId afterwards:
a) I want to know did message with this messageID reach specific subscriber - how do I do that?
b) I want to know did message with this messageID reach BQ (in case subscriber has BigQuery delivery type) - how do I find out?

Thanks a lot!


Solution

  • BigQuery subscriptions can be configured to write the Pub/Sub message metadata. This include the messageId.

    Your BigQuery table schema must include the message_id column along with other metadata columns.

    With those columns included in your BigQuery table schema and the Write metadata option enabled, the Pub/Sub messages should persist in the BigQuery table with the associated Pub/Sub messageId.

    See https://cloud.google.com/pubsub/docs/bigquery#properties_subscription for complete details.