Creating pubsub subscription with message filtering

  • date 31st May, 2021 |
  • by Prwatech |
  • 0 Comments

Prerequisites

GCP account

Open Console.

Open  Menu > Pubsub > Subscriptions

Click on create  Subscription

Give the subscription ID.

Choose the pubsub topic.

Choose the delivery type.

Choose the retention period for message. Choose the expiration period.

Give the Acknowledgement time

In subscription filter give the filter syntax.

These filter types you can use to filter the messages.

FilterDescription
attributes:domainMessages with the domain attribute
NOT attributes:domainMessages without the domain attribute
attributes.domain = “com”Messages with the domain attribute and the value of com
attributes.domain != “com”Messages without the domain attribute and the value of com
hasPrefix(attributes.domain, “co”)Messages with the domain attribute and a value that starts with co
NOT hasPrefix(attributes.domain, “co”)Messages without the domain attribute and a value that starts with co

Click create. The subscription with message filtering will be created

Quick Support

image image