Google PubSub
Google Pub/Sub Channel Integration
The Google Pub/Sub extension for @nestjstools/messaging
enables cloud-native, event-driven communication across distributed systems. Itβs ideal for scalable, serverless-friendly applications that rely on Google Cloud infrastructure.
π¦ Installation
Install the core messaging package and the Google Pub/Sub extension:
or
βοΈ Example Configuration
π οΈ PubSubChannelConfig Properties
name
The channel name (e.g., 'pubsub-events'
).
β
projectId
Google Cloud project ID.
β
topic
The Pub/Sub topic to publish messages to.
β
subscription
Subscription name to consume messages from.
β
middlewares
Array of middlewares applied to incoming/outgoing messages.
[]
autoCreate
Automatically create topic/subscription if they do not exist.
true
enableSubscriber
Enables the background subscriber to listen to incoming Pub/Sub messages.
true
avoidErrorsForNotExistedHandlers
Silently skips messages without a matching handler.
false
π Key Features
Cloud-Native Messaging: Leverages Google Pub/Sub for reliable, asynchronous communication across microservices.
Auto Resource Provisioning: Automatically creates missing topics and subscriptions when
autoCreate
is enabled.Efficient Scaling: Suitable for horizontally scaled environments (e.g., Kubernetes, Cloud Run).
Graceful Error Handling: Skip errors when no handler exists by enabling
avoidErrorsForNotExistedHandlers
.Subscriber Control: Toggle subscriber activation with
enableSubscriber
.
Last updated