Set Up a Pub/Sub Topic
Create a Pub/Sub topic and let applications publish to it or subscribe to it. The platform encrypts topics at rest with Google-managed keys.
Prerequisites
- An
Applicationmanifest for each publisher and subscriber. - The names of your
organization,organizational-unit,environmentandproject.
Steps
-
Create the
PubSubmanifest.apiVersion: lowops.manifests.v1
kind: PubSub
metadata:
name: order-events
project: payment-gateway
environment: production
organizational-unit: retail-banking
organization: fincorp
spec:
description: "Events emitted when an order is created, updated, or completed"
messageRetentionDurationSeconds: 604800 # 7 daysmessageRetentionDurationSecondssets how long the topic keeps messages that no subscriber acknowledged. The schema also has the fieldsencryptedandallowedPersistenceRegions. The engine does not apply them yet. See thePubSubreference. -
Grant access in the
accessControlblock of each application.# In the publisher Application:
spec:
accessControl:
pubsub:
publishTo: [order-events] # grants roles/pubsub.publisher
# In the subscriber Application:
spec:
accessControl:
pubsub:
subscribeTo: [order-events] # grants roles/pubsub.subscriberOne application can have both lists.
-
Commit all manifests in one pull request and merge it.
Verify
The run shows the topic as created. The platform restarts each application that has new permissions.