GCP Pub/Sub

Detailed documentation on the GCP Pub/Sub component

Setup GCP Pub/Sub

Follow the instructions here on setting up Google Cloud Pub/Sub system.

Create a Dapr component

The next step is to create a Dapr component for Google Cloud Pub/Sub

Create the following YAML file named messagebus.yaml:

apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
  name: <NAME>
  namespace: <NAMESPACE>
spec:
  type: pubsub.gcp.pubsub
  metadata:
  - name: topic
    value: <TOPIC_NAME>
  - name: type
    value: service_account
  - name: project_id
    value: <PROJECT_ID> # replace
  - name: private_key_id
    value: <PRIVATE_KEY_ID> #replace
  - name: client_email
    value: <CLIENT_EMAIL> #replace
  - name: client_id
    value: <CLIENT_ID> # replace
  - name: auth_uri
    value: https://accounts.google.com/o/oauth2/auth
  - name: token_uri
    value: https://oauth2.googleapis.com/token
  - name: auth_provider_x509_cert_url
    value: https://www.googleapis.com/oauth2/v1/certs
  - name: client_x509_cert_url
    value: https://www.googleapis.com/robot/v1/metadata/x509/<PROJECT_NAME>.iam.gserviceaccount.com
  - name: private_key
    value: <PRIVATE_KEY> # replace x509 cert here
  - name: disableEntityManagement
    value: <REPLACE-WITH-DISABLE-ENTITY-MANAGEMENT> # Optional. Default: false. When set to true, topics and subscriptions do not get created automatically.
  • topic is the Pub/Sub topic name.
  • type is the GCP credentials type.
  • project_id is the GCP project id.
  • private_key_id is the GCP private key id.
  • client_email is the GCP client email.
  • client_id is the GCP client id.
  • auth_uri is Google account OAuth endpoint.
  • token_uri is Google account token uri.
  • auth_provider_x509_cert_url is the GCP credentials cert url.
  • client_x509_cert_url is the GCP credentials project x509 cert url.
  • private_key is the GCP credentials private key.
  • disableEntityManagement Optional. Default: false. When set to true, topics and subscriptions do not get created automatically.

Apply the configuration

Visit this guide for instructions on configuring pub/sub components.