API Docs - v2.0.2
Tested Siddhi Core version: 5.1.5
It could also support other Siddhi Core minor versions.
Sink
googlepubsub (Sink)
The GooglePubSub sink publishes messages to a topic in the GooglePubSub server. If the required topic does not exist, GooglePubSub Sink creates the topic and publishes messages to it.
Syntax@sink(type="googlepubsub", project.id="<STRING>", topic.id="<STRING>", credential.path="<STRING>", @map(...)))
QUERY PARAMETERS
Name | Description | Default Value | Possible Data Types | Optional | Dynamic |
---|---|---|---|---|---|
project.id | The unique ID of the GCP console project within which the topic is created. |
STRING | No | No | |
topic.id | The ID of the topic to which the messages that are processed by Siddhi are published. |
STRING | No | No | |
credential.path | The file path of the service account credentials. |
STRING | No | No |
Examples EXAMPLE 1
@sink(type = 'googlepubsub', @map(type= 'text'),
project.id = 'sp-path-1547649404768',
credential.path = 'src/test/resources/security/sp.json',
topic.id ='topicA',
)
define stream InputStream(message string);
This query publishes messages to a topic in the GooglePubSub 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.
Source
googlepubsub (Source)
The GooglePubSub source receives events to be processed by Siddhi from a topic in a GooglePubSub server. Here, a subscriber client creates a subscription to that topic and consumes messages via the subscription. The subscription applications receive only the messages that are published after the subscription is created. A subscription connects a topic to a subscriber application, enabling the application to receive and process messages from that topic. A topic can have multiple subscriptions, but a given subscription belongs only to a single topic.
Syntax@source(type="googlepubsub", project.id="<STRING>", topic.id="<STRING>", subscription.id="<STRING>", credential.path="<STRING>", @map(...)))
QUERY PARAMETERS
Name | Description | Default Value | Possible Data Types | Optional | Dynamic |
---|---|---|---|---|---|
project.id | The unique ID of the GCP console project within which the topic is created. |
STRING | No | No | |
topic.id | The unique ID of the topic from which the messages are received. |
STRING | No | No | |
subscription.id | The unique ID of the subscription from which messages must be retrieved. |
STRING | No | No | |
credential.path | The file path of the service account credentials. |
STRING | No | No |
Examples EXAMPLE 1
@source(type='googlepubsub',@map(type='text'),
topic.id='topicA',
project.id='sp-path-1547649404768',
credential.path = 'src/test/resources/security/sp.json',
subscription.id='subA',
)
define stream OutputStream(message String);
This query shows how to subscribe to a googlepubsub topic. Here, a googlepubsub source subscribes to the 'topicA' topic that resides in the 'sp-path-1547649404768' project within a googlepubsub instance. The events are received in the text format, mapped to a Siddhi event, and then sent to a stream named OutputStream.