Google Pub/Sub Connector Reference¶
The following operations allow you to work with the Google Pub/Sub Connector. Click an operation name to see parameter details and samples on how to use it.
To use the Google Pub/Sub connector, add the
Google Pub/Sub uses the OAuth 2.0 protocol for authentication and authorization. All requests to the Google Cloud Pub/Sub API must be authorized by an authenticated user.
googlepubsub.init
This operation allows you to initialize the connection to Google Pub/Sub.
Parameter Name | Description | Required |
---|---|---|
apiUrl | The application URL of Google Pub/Sub. | Yes |
apiVersion | The version of the Google Pub/Sub API. | Yes |
accessToken | The access token that grants access to the Google Pub/Sub API on behalf of a user. | Yes |
clientId | The client id provided by the Google developer console. | Yes |
clientSecret | The client secret provided by the Google developer console. | Yes |
refreshToken | The refresh token provided by the Google developer console, which can be used to obtain new access tokens. | Yes |
blocking | Set this to true if you want the connector to perform blocking invocations to Google Pub/Sub. | Yes |
tokenEndpoint | The token endpoint of the Google API. The default will be set to https://www.googleapis.com/oauth2/v4/token if not provided. | Yes |
Sample configuration
<googlepubsub.init>
<apiUrl>{$ctx:apiUrl}</apiUrl>
<apiVersion>{$ctx:apiVersion}</apiVersion>
<accessToken>{$ctx:accessToken}</accessToken>
<clientId>{$ctx:clientId}</clientId>
<clientSecret>{$ctx:clientSecret}</clientSecret>
<refreshToken>{$ctx:refreshToken}</refreshToken>
<blocking>{$ctx:blocking}</blocking>
<tokenEndpoint>{$ctx:tokenEndpoint}</tokenEndpoint>
</googlepubsub.init>
Project Topics¶
createTopic
The createTopic operation creates a new topic with a name that you specify. See the related API documentation for more information.
Parameter Name | Description | Required |
---|---|---|
topicName | The name of the topic that you are creating. | Yes |
projectId | The unique ID of the project within which you want to create the topic. | Yes |
Sample configuration
<googlepubsub.createTopic>
<topicName>{$ctx:topicName}</topicName>
<projectId>{$ctx:projectId}</projectId>
</googlepubsub.createTopic>
Sample request
{
"apiUrl":"https://pubsub.googleapis.com",
"apiVersion":"v1",
"accessToken": "ya29.GlwG2NhgX_NQhxjtF_0G9bzf0FEj_shNWgF_GXmjeYQF0XQXrBjjcrJukforOeyTAHoFfSQW0x-OrrZ2lj47Z6k6DAYZuUv3ZhJMl-ll4mvouAbc",
"topicName":"topicA",
"projectId":"rising-parser-123456"
}
publishMessage
The publishMessage operation publishes messages to a specified topic. See the related API documentation for more information.
Parameter Name | Description | Required |
---|---|---|
topicName | The unique name of the topic to which messages should be published. | Yes |
projectId | The unique ID of the project within which the topic is created. | Yes |
data | The message payload. | Yes |
attributes | Additional attributes of the message. | Optional |
Sample configuration
<googlepubsub.publishMessage>
<topicName>{$ctx:topicName}</topicName>
<projectId>{$ctx:projectId}</projectId>
<data>{$ctx:data}</data>
<attributes>{$ctx:attributes}</attributes>
</googlepubsub.publishMessage>
Sample request
{
"apiUrl":"https://pubsub.googleapis.com",
"apiVersion":"v1",
"accessToken": "ya29.GlwG2NhgX_NQhxjtF_0G9bzf0FEj_shNWgF_GXmjeYQF0XQXrBjjcrJukforOeyTAHoFfSQW0x-OrrZ2lj47Z6k6DAYZuUv3ZhJMl-ll4mvouAbc",
"topicName":"topicA",
"projectId":"rising-parser-123456"
}
Project Subscriptions¶
createTopicSubscription
The createTopicSubscription operation creates a subscription to a topic that you specify. See the related API documentation for more information.
Parameter Name | Description | Required |
---|---|---|
topicName | The name of the topic that you are creating. | Yes |
projectId | The unique ID of the project within which you want to create the topic. | Yes |
subscriptionName | The name of the subscription. | Yes |
ackDeadlineSeconds | The maximum time a subscriber can take to acknowledge a message that is received. | Optional |
pushEndpoint | The URL that specifies the endpoint to which messages should be pushed. | Optional |
attributes | Additional endpoint configuration attributes. | Optional |
Sample configuration
<googlepubsub.createTopicSubscription>
<topicName>{$ctx:topicName}</topicName>
<projectId>{$ctx:projectId}</projectId>
<subscriptionName>{$ctx:subscriptionName}</subscriptionName>
<ackDeadlineSeconds>{$ctx:ackDeadlineSeconds}</ackDeadlineSeconds>
<pushEndpoint>{$ctx:pushEndpoint}</pushEndpoint>
<attributes>{$ctx:attributes}</attributes>
</googlepubsub.createTopicSubscription>
Sample request
{
"apiUrl":"https://pubsub.googleapis.com",
"apiVersion":"v1",
"accessToken": "ya29.GlwAJG2NhgX_NQhxjtF_0G9bzf0FEj_shNWgF_GXmYFpwIxjeYQF0XQXukforOeyTAHoFfSQW0x-OrrZ2lj47Z6k6DAYZuUv3ZhJMl-ll4mvouAbc",
"projectId":"rising-parser-123456",
"topicName":"topicA",
"subscriptionName":"mysubA",
"ackDeadlineSeconds":"30",
"pushEndpoint": "https://example.com/push",
"attributes": {"key": "value1","key2":"values2"}
}
pullMessage
The pullMessage operation retrieves messages that are published to a topic. See the related API documentation for more information.
Parameter Name | Description | Required |
---|---|---|
topicName | The name of the topic to which the subscription belongs. | Yes |
projectId | The unique ID of the project within which the topic is created. | Yes |
subscriptionName | The name of the subscription from which messages should be retrieved. | Yes |
maxMessages | The maximum number of messages to retrieve. | Optional |
returnImmediately | Set this to true if you want the server to respond immediately. | Optional |
Sample configuration
<googlepubsub.pullMessage>
<topicName>{$ctx:topicName}</topicName>
<projectId>{$ctx:projectId}</projectId>
<subscriptionName>{$ctx:subscriptionName}</subscriptionName>
<maxMessages>{$ctx:maxMessages}</maxMessages>
<returnImmediately>{$ctx:returnImmediately}</returnImmediately>
</googlepubsub.pullMessage>
Sample request
{
"apiUrl":"https://pubsub.googleapis.com",
"apiVersion":"v1",
"accessToken": "ya29.GlwABbJG2NhgX_NQhxjtF_0G9bzf0FEj_shNWgF_GXmYFpwIxjeYQF0XjcrJukforOeyTAHoFfSQW0x-OrrZ2lj47Z6k6DAYZuUv3ZhJMl-ll4mvouAbc",
"topicName":"topicA",
"projectId":"rising-parser-123456",
"subscriptionName":"mysubA",
"maxMessages":"2",
"returnImmediately":"false"
}