Google Pub/Sub agent
Target Google Pub/Sub
Prerequisites
To have Gluesync working on your Google Pub/Sub instance you will need to have:
-
Valid Project Id, can be taken from your Google Cloud console;
-
Pre-defined Topics;
-
Valid user credentials with permission to post to the desired topics;
-
Service JSON file containing the credential informations to be issued to Gluesync to establish a secure connection with Google Cloud infrastructure.
Setup via Web UI
-
Project Id: Your Google Cloud Project Id;
-
Port: Optional, defaults to
443. -
Service Agent (.json) file: (required, defaults to
NULL) The Service Agent JSON file; The certificate must be uploaded to the agent, to do it, you need to either upload it via the UI or mount the certificate as a volume.
To learn more about how to mount a certificate as a volume, check out this documentation.
| Looking for more information about Google Service Account? Check out the [Service Account documentation](cloud.google.com/iam/docs/service-accounts) from Google. |
Setup via Rest APIs
Here following an example of calling the Core Hub’s Rest API via curl to setup the connection for this Agent.
Connect the agent
curl --location --request PUT 'http://core-hub-ip-address:1717/pipelines/{pipelineId}/agents/{agentId}/config/credentials' \
--header 'Content-Type: application/json' \
--header 'Authorization: ••••••' \
--data '{
"hostCredentials": {
"connectionName": "myAgentNickName",
"host": "project-id",
"port": 443,
"username": "",
"password": "",
"disableAuth": false,
"certificatePath": "/myPath/service-agent.json"
}
}'
Topics management
To push changes feed to a Google Pub/Sub topic this has to be created first from within your Google Pub/Sub console.
Messages format & keys
Gluesync encapsulates the message in JSON format into the defined Pub/Sub topics, the message structure looks like the following represented by the screen below.
Message format contains the following attributed kets:
-
key: custom user-defined key; -
operation:i,u,doperation identifiers to discern between inserts, updates and deletions operations.
| For delete operations the document body will be sent empty while the key field will still be valorized with the document key belonging to the delete operation. |