Skip to main content
Google Cloud PubSub Source

Config

The pubsub_emulator_host parameter is optional, which could be used when you need to test the Google Cloud PubSub service locally through an emulator (see more details at the bottom).

Start Mage

Create a new pipeline

  1. Open Mage in your browser.
  2. Click + New pipeline, then select Streaming.
  3. Add a data loader block, select Google Cloud PubSub, and change the settings to those of your PubSub project:
  4. Add a transformer block and paste the following:
  5. Add a data exporter block, select Dummy and keep the default settings:

Image of the testing pipeline for "Google Cloud PubSub Source"

Test pipeline

Open the streaming pipeline you just created, and in the right side panel near the bottom, click the button Execute pipeline to test the pipeline.

Publish some testing messages

Please use the publisher example given in the Testing apps locally with the emulator
You should see an output similar to the following:

Set up Google Cloud Pubsub emulator

To test out Google Cloud PubSub source locally, follow the instructions in Testing apps locally with the emulator to set up the local Google Cloud PubSub emulator.

Create a project_id for testing

Use the command listed under the Starting the emulator section to create a project_id, e.g.,

Create a topic and a subscription

Use the gcloud pubsub topics create command to create a topic:
After you create a topic, you can subscribe or publish to it. Use the gcloud pubsub subscriptions create command to create a subscription.
Only messages published to the topic after the subscription is created are available to subscriber applications.