Skip to main content

Google Pub-Sub

The Google PubSub sink publishes messages to a topic in the Google PubSub server. If the required topic does not exist, Google PubSub Sink creates the topic and publishes messages to it.

Syntax

CREATE SINK <name> WITH (type="googlepubsub", project.id="<STRING>", topic.id="<STRING>", credential.path="<STRING>", map.type=<"STRING>")

Query Parameters

NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
project.idThe unique ID of the GCP console project within which the topic is created.STRINGNoNo
topic.idThe ID of the topic to which the messages that are processed by Macrometa are published.STRINGNoNo
credential.pathThe path to the service account credentials.STRINGNoNo

Example 1

CREATE SINK InputStream WITH (type = 'googlepubsub', map.type= 'text', project.id = 'sp-path-1547649404768', credential.path = '<path-to-credentials>', topic.id ='topicA') (message string);

This query publishes messages to a topic in the Google PubSub server. Here, the messages are published to topicA topic in the sp-path-1547649404768 project. If the topicA topic already exists in the sp-path-1547649404768 project, messages are directly published to that topic.

If it does not exist, a topic with that ID is newly created in the project and then, the messages are published to that topic.