Skip to main content

Google Cloud Pub/Sub

Google Cloud Pub/Sub is a messaging service that allows you to send and receive messages between independent applications. It provides a scalable, reliable, and real-time messaging platform.

Prerequisite

  1. Authentication Requirements: Before connecting to Google Cloud Pub/Sub, make sure you have the necessary authentication credentials, including:

    • Google Cloud Project ID.
    • Service Account Key File: Create a Service Account on the Google Cloud Console and generate a JSON key file. This key file contains the credentials required for authentication.
      Service Account
      Service Account
  2. Enable Google Cloud Pub/Sub API: In the Google Cloud Console, ensure that the Google Cloud Pub/Sub API is enabled for your project. This API allows your application to interact with Google Cloud Pub/Sub.

  3. Service Account Access: Grant the Service Account associated with your application the necessary permissions to access Google Cloud Pub/Sub. Assign appropriate roles, such as Pub/Sub Publisher or Pub/Sub Subscriber, to the Service Account.

  4. Download and Secure Key: Download the JSON key file generated for the Service Account. Safeguard this key file as it contains essential credentials for authenticating your application's access to Google Cloud Pub/Sub.

Configuring Connector in DronaHQ

Configure your messaging category using the provided details. Validate the connection with Test connection and Save settings for a secure messaging setup.

General

FieldDescription
Private KeyPaste the contents of the Private Key obtained from the Firebase console or GCP console.
Google Cloud Pub/Sub Configuration
Google Cloud Pub/Sub Configuration

Admin

Advanced OptionsDescription
Connection OptionsThe key and value connection options in the connector configuration refer to specific settings (keys) and their corresponding values that dictate how the application connects to Google Cloud Pub/Sub.
Whitelist IPEnhance security by restricting messaging access to specific whitelisted IP addresses.

Adding Actions

To publish a message to Google Cloud Pub/Sub or subscribe to messages, follow these steps:

  1. Define Query Name: Assign a meaningful query name that represents the specific data retrieval operation you are performing. This name will be used as an identifier in your Connector Library.

  2. Select Action - Publish or Subscribe: In the Google Cloud Pub/Sub connector options, choose from list of available actions. Choose the Get Topic action. This action allows you to fetch information about a specific topic within your Google Cloud Pub/Sub configuration.

  3. Configure Action Inputs:

    • Specify the Topic or Subscription (for Subscribe): Select the topic or subscription you want to use for this action.
    • Provide the Message: Enter the content of the message you want to publish.
    Action InputsDescription
    ProjectThe Google Cloud Project ID used in your Pub/Sub setup.
    Page SizeThe number of results to display per page when listing topics or subscriptions.
    Page TokenA token to continue a previous list request when dealing with paginated results.
    TopicThe name of the topic to which the message will be published.
    Subscription (for Subscribe)The name of the subscription from which you want to receive messages.
    MessageThe content of the message to be published.
    AttributesTo provide additional information and context for processing
    Ordering KeyProvide the key of the message you want to be delivered to subscribers.
  4. Execute and View Response:

    • Run the configured action to publish or subscribe to messages.
    • The response will contain the outcome of the action, such as a confirmation of message publication or the received message content.
    Google Cloud Pub/Sub Actions
    Google Cloud Pub/Sub Actions
Utilize dynamic variables to make your messaging actions more flexible. Test with sample data before saving. Link

dynamic variables to controls/actions and more for runtime use. :::

Saved actions appear under your connector in Connector Library.

Supported Actions

ActionDescription
Publish to a TopicSend a message to a specific topic in Google Cloud Pub/Sub.
List Project TopicsRetrieve a list of topics within your Google Cloud project.
List Project SubscriptionsRetrieve a list of subscriptions within your Google Cloud project.
List Topic SubscriptionsGet a list of subscriptions associated with a specific topic.
Get TopicRetrieve detailed information about a specific topic.
Get SubscriptionRetrieve detailed information about a specific subscription.
Publish to a TopicSend a message to a specific topic in Google Cloud Pub/Sub.

Using Google Cloud Pub/Sub Connector

Publishing and Subscribing to Messages

To send and receive messages using the Google Cloud Pub/Sub Connector, follow these steps:

  1. Access the messaging section or control action where you intend to publish or subscribe to messages.

  2. Select Google Cloud Pub/Sub Connector from Data Options -> Quick Select -> Message Actions:

    • Choose Google Cloud Pub/Sub Connector from the available options.
    • Select the configured query action depending on whether you want to send or receive messages.
    • Click on Continue to proceed.
  3. Configure the action based on your requirements:

    • For publishing, specify the topic and message content.
    • For subscribing, select the subscription to receive messages from.
  4. Integrate this action into your application by connecting it to controls or actions as needed. Ensure you handle incoming messages appropriately.