Overview
This node listens to messages from a specified Google Cloud Pub/Sub topic and subscription. It is useful for workflows that need to react to real-time events or data published to a Pub/Sub topic, such as processing messages from IoT devices, user activity logs, or system alerts. The node can automatically create the subscription if it doesn't exist and optionally decode message data from JSON format.
Use Case Examples
- A workflow that triggers when a new message is published to a Pub/Sub topic containing user activity data, automatically processing and storing it.
- A workflow that listens to system alerts published to a Pub/Sub topic and sends notifications based on the alert content.
Properties
| Name | Meaning |
|---|---|
| Project Id. | Google Cloud project id used to identify the project containing the Pub/Sub topic and subscription. |
| Topic | Name of the Google Pub/Sub topic to listen to for incoming messages. |
| Subscription | Name of the Google Pub/Sub subscription for the topic. The subscription will be created if it does not exist. |
| Decode JSON | If enabled, the node will automatically decode the message data from JSON format into a JavaScript object. |
Output
JSON
id- The unique identifier of the received Pub/Sub message.data- The content of the message, either as a decoded JSON object or a plain string depending on the Decode JSON setting.attributes- Attributes associated with the Pub/Sub message, if any.
Dependencies
- Google Cloud Pub/Sub API
- Google Auth Library
Troubleshooting
- Ensure that the provided Google Cloud project ID, topic, and subscription names are correct and that the authenticated service account has the necessary Pub/Sub permissions.
- If the subscription does not exist, the node attempts to create it; ensure the service account has permission to create subscriptions.
- If Decode JSON is enabled but the message data is not valid JSON, a warning will be logged and the raw string will be used instead.
- Timeout error may occur if no message is received within 30 seconds during manual trigger execution; this timeout does not apply to active workflows.
Links
- Google Cloud Pub/Sub Documentation - Official documentation for Google Cloud Pub/Sub service.
- Google Cloud Pub/Sub Subscriber Guide - Guide on how to subscribe and receive messages from Pub/Sub topics.
