Skip to main content

GCP Pub/Sub

Type: pubsub.gcp.pubsub

Status: stable

Reference: https://docs.dapr.io/reference/components-reference/supported-pubsub/setup-gcp-pubsub/

Example

apiVersion: cra.diagrid.io/v1beta1
kind: Component
metadata:
name: <name>
spec:
type: pubsub.gcp.pubsub
version: v1
metadata:
# GCP client email.
- name: clientEmail
value: "client@email.com"
# The GCP client ID.
- name: clientID
value: "0123456789-0123456789"
# The GCP credentials private key. Replace with the value of "private_key" field of the Service Account Key file.
- name: privateKey
value: |
-----BEGIN PRIVATE KEY-----
MIIE...\
-----END PRIVATE KEY-----

# The GCP private key id. Replace with the value of "private_key_id" field of the Service Account Key file.
- name: privateKeyID
value: "privateKeyID"
# GCP project id.
- name: projectID
value: "projectID"
# The GCP URL of the public x509 certificate, used to verify the signature on JWTs, such as ID tokens, signed by the authentication provider. (Optional)
#- name: authProviderX509CertURL
# value: "https://www.googleapis.com/oauth2/v1/certs"
# The GCP account OAuth2 authorization server endpoint URI. (Optional)
#- name: authURI
# value: "https://accounts.google.com/o/oauth2/auth"
# The GCP URL of the public x509 certificate, used to verify JWTs signed by the client. (Optional)
#- name: clientX509CertURL
# value: "https://www.googleapis.com/robot/v1/metadata/x509/<PROJECT_NAME>.iam.gserviceaccount.com"
# The GCP account token server endpoint URI. (Optional)
#- name: tokenURI
# value: "https://oauth2.googleapis.com/token"
# The GCP credentials type. (Optional)
#- name: type
# value: "service_account"
# Message acknowledgement duration deadline. Allows users to specify a custom message acknowledgment deadline after which a redelivery of the message will be performed if the message was not acknowledged. (Optional)
#- name: ackDeadline
# value: "20s"
# Time in seconds to wait between connection recovery attempts. (Optional)
#- name: connectionRecoveryInSec
# value: "2"
# Set the consumer ID to control namespacing. Defaults to the app's ID. (Optional)
#- name: consumerID
# value: "{namespace}"
# Name of the GCP Pub/Sub Topic. The topic must exist before using this component. (Optional)
#- name: deadLetterTopic
# value: "myapp-dlq"
# When set to true, topics and subscriptions do not get created automatically. (Optional)
#- name: disableEntityManagement
# value: "false"
# When set to "true", subscribed messages will be received in order, depending on publishing and permissions configuration. (Optional)
#- name: enableMessageOrdering
# value: "false"
# GCP endpoint for the component to use. Only used for local development, for example with the GCP Pub/Sub Emulator. The endpoint is unnecessary when running against the GCP production API. (Optional)
#- name: endpoint
# value: "http://mycompany.com:8085"
# Max number of concurrent streaming-pull connections to maintain (Optional)
#- name: maxConcurrentConnections
# value: "10"
# Maximum number of attempts to deliver the message. If "deadLetterTopic" is specified as well, "maxDeliveryAttempts" is the maximum number of attempts before messages are moved to the dead-letter queue. (Optional)
#- name: maxDeliveryAttempts
# value: "5"
# Maximum number of bytes a GCP streaming-pull connection is allowed to have outstanding (Optional)
#- name: maxOutstandingBytes
# value: "1e9"
# Maximum number of messages a GCP streaming-pull connection is allowed to have outstanding (Optional)
#- name: maxOutstandingMessages
# value: "1000"
# Defines the maximum number of reconnect attempts. (Optional)
#- name: maxReconnectionAttempts
# value: "30"
# The key provided in the request. It's used when "enableMessageOrdering" is set to true to order messages based on such key. (Optional)
#- name: orderingKey
# value: "my-orderingkey"

Authentication profiles

Available authentication profiles:

  • GCP API Authentication with Service Account Key

GCP API Authentication with Service Account Key

Authenticate authenticates API calls with the given service account or refresh token JSON credentials.

clientEmail (string)

Required - GCP client email.

Example value: client@email.com

clientID (string)

Required - The GCP client ID.

Example value: 0123456789-0123456789

privateKey

Required - The GCP credentials private key. Replace with the value of "private_key" field of the Service Account Key file.

Example value:

-----BEGIN PRIVATE KEY-----\nMIIE...\\n-----END PRIVATE KEY-----\n

privateKeyID

Required - The GCP private key id. Replace with the value of "private_key_id" field of the Service Account Key file.

Example value: privateKeyID

projectID (string)

Required - GCP project id.

Example value: projectID

authProviderX509CertURL (string)

The GCP URL of the public x509 certificate, used to verify the signature on JWTs, such as ID tokens, signed by the authentication provider.

Example value: https://www.googleapis.com/oauth2/v1/certs

authURI (string)

The GCP account OAuth2 authorization server endpoint URI.

Example value: https://accounts.google.com/o/oauth2/auth

clientX509CertURL (string)

The GCP URL of the public x509 certificate, used to verify JWTs signed by the client.

Example value: https://www.googleapis.com/robot/v1/metadata/x509/<PROJECT_NAME>.iam.gserviceaccount.com

tokenURI (string)

The GCP account token server endpoint URI.

Example value: https://oauth2.googleapis.com/token

type (string)

The GCP credentials type.

Example value: service_account

Allowed values:

  • service_account

Metadata

ackDeadline

Message acknowledgement duration deadline. Allows users to specify a custom message acknowledgment deadline after which a redelivery of the message will be performed if the message was not acknowledged.

Default value: 20s

Example value: 1m

connectionRecoveryInSec (number)

Time in seconds to wait between connection recovery attempts.

Default value: 2

Example value: 2

consumerID (string)

Set the consumer ID to control namespacing. Defaults to the app's ID.

Example value: {namespace}

Documentation: https://docs.dapr.io/developing-applications/building-blocks/pubsub/pubsub-overview/#consumer-groups-and-competing-consumers-pattern

deadLetterTopic (string)

Name of the GCP Pub/Sub Topic. The topic must exist before using this component.

Example value: myapp-dlq

disableEntityManagement (bool)

When set to true, topics and subscriptions do not get created automatically.

Default value: false

Example value: true, false

enableMessageOrdering (bool)

When set to "true", subscribed messages will be received in order, depending on publishing and permissions configuration.

Default value: false

Example value: true, false

endpoint (string)

GCP endpoint for the component to use. Only used for local development, for example with the GCP Pub/Sub Emulator. The endpoint is unnecessary when running against the GCP production API.

Example value: http://mycompany.com:8085

maxConcurrentConnections (number)

Max number of concurrent streaming-pull connections to maintain

Example value: 10

maxDeliveryAttempts (number)

Maximum number of attempts to deliver the message. If "deadLetterTopic" is specified as well, "maxDeliveryAttempts" is the maximum number of attempts before messages are moved to the dead-letter queue.

Default value: 5

Example value: 5

maxOutstandingBytes (number)

Maximum number of bytes a GCP streaming-pull connection is allowed to have outstanding

Example value: 1e9

maxOutstandingMessages (number)

Maximum number of messages a GCP streaming-pull connection is allowed to have outstanding

Example value: 1000

maxReconnectionAttempts (number)

Defines the maximum number of reconnect attempts.

Default value: 30

Example value: 30

orderingKey (string)

The key provided in the request. It's used when "enableMessageOrdering" is set to true to order messages based on such key.

Example value: my-orderingkey