How-To Guides
Integration Guides

Google Cloud Pub/Sub Integration Guide

16min
review the following guide for setting up an integration between litmus edge and google pub/sub service https //cloud google com/pubsub/docs/overview once the integration is set up, you can use it for the following publishing data from a topic in your edge device to a subscription topic in the google cloud platform (gcp) subscribing to data published by a publication topic in the google cloud platform before you begin you need to create a google service account make sure the account has the correct roles and permissions required for setting up the connection refer to the following google resources for learning more about pub/sub and configuring connections google pub/sub service https //cloud google com/pubsub/docs/overview configure private google access for on premises hosts > domain options (information regarding private access to gcp services) supported products and limitations > pub/sub (information regarding private access to gcp services) sdk on publish settings publish messages to topics set up the outbound connection (publish to google pub/sub) follow the steps below to set up the outbound connection step 1 create publication topic in google cloud platform in the google cloud platform, create a publication topic a matching subscription topic is created automatically, with the sub suffix appended to the topic name step 2 add device follow the steps to connect a device docid 3eyafppweuvmblcey17sq the device will be used to store tags that will be eventually used to create outbound topics in the connector make sure to select the enable data store checkbox step 3 add tags after connecting the device in litmus edge, you can add tags docid 8se7z3pmrfwl1nmzcwalx to the device create tags that you want to use to create outbound topics for the connector step 4 add the google cloud pub/sub connector follow the steps to add a connector docid\ ogw7fkqbwidbabn4wl5rr and select the google cloud pub/sub connector provider for more information about message publication settings, see the sdk on publish settings configure the following parameters name enter a name for the connector service account key ( json) copy or save the json key from your google cloud platform and paste or upload it here the project id of the cloud project copy the id from your google cloud platform and paste it here the private key id of the cloud project copy the key id from your google cloud platform and paste it here the client email of the cloud project enter the email from your google cloud platform integration topic copy the name of the publication topic (without the " sub" suffix) from your google cloud platform and paste it here custom attributes you can add custom attributes in key/value pairs for further data processing refer to the following to learn more use custom attributes in the google cloud pub/sub connector docid 2zrf3qp5npnkhmxstxrlm google documentation for using attributes parallel publish count the number of messages being published simultaneously the default value is 100 parallel byte threshold the minimum size of a batch (in bytes) for the batch to be published the default value is zero, which means that there is no threshold (limit) publish count threshold the minimum number of messages in a batch for the batch to be published the default value is zero, which means that there is no threshold (limit) publish delay threshold (milliseconds) the maximum time that the client will attempt to publish a batch of messages the default value is zero, which means that there is no threshold (limit) throttling limit the maximum number of messages per second to be processed the default value is zero, which means that there is no limit persistent storage when enabled, this will cause messages to undergo a store and forward procedure messages will be stored within litmus edge when cloud providers are online queue mode select the queue mode as lifo (last in first out) or fifo (first in first out) selecting lifo means that the last data entry is processed first, and selecting fifo means the first data entry is processed first step 5 enable the connector after adding the connector, click the toggle in the connector tile to enable it if you see a failed status, you can review the manage connectors docid 3u7jzldinehy8shvifd d and relevant error messages step 6 create outbound topics for connector you will now need to import the tags you added in step 2 to the connector as topics to create outbound topics click the connector tile the connector dashboard appears click the topics tab click the import from devicehub tags icon the devicehub import dialog box appears select all the tags to import and click import after importing the tag(s), do the following edit the tag and configure the remote data topic copy and paste the name of the subscription topic (with the sub suffix) from your google cloud platform make sure the connector has a connected status step 7 enable topics because you imported devicehub tags for a connected connector, all topics will be disabled to enable the topics, return to the topics tab and click the enable all topics icon step 8 verify connection in google cloud platform to verify the connection in google cloud platform pull the subscription topic to see messages it receives from the litmus edge outbound topics created previously view the subscription statistics set up the inbound connection (subscribe to google pub/sub) follow the steps below to set up the inbound connection see publish messages to topics to learn more about publishing messages in google pub/sub step 1 create publication topic in google cloud platform in the google cloud platform, create a publication topic step 2 add the google cloud pub/sub connector follow the steps to add a connector docid\ ogw7fkqbwidbabn4wl5rr and select the google cloud pub/sub connector provider configure the following parameters name enter a name for the connector service account key ( json) copy or save the json key from your google cloud platform and paste or upload it here the project id of the cloud project copy the id from your google cloud platform and paste it here the private key id of the cloud project copy the key id from your google cloud platform and paste it here the client email of the cloud project enter the email from your google cloud platform integration topic copy the name of the publication topic (without the " sub" suffix) from your google cloud platform and paste it here custom attributes you can add custom attributes in key/value pairs for further data processing refer to the following to learn more use custom attributes in the google cloud pub/sub connector docid 2zrf3qp5npnkhmxstxrlm google documentation for using attributes parallel publish count the number of messages being published simultaneously the default value is 100 parallel byte threshold the minimum size of a batch (in bytes) for the batch to be published the default value is zero, which means that there is no threshold (limit) publish count threshold the minimum number of messages in a batch for the batch to be published the default value is zero, which means that there is no threshold (limit) publish delay threshold (milliseconds) the maximum time that the client will attempt to publish a batch of messages the default value is zero, which means that there is no threshold (limit) throttling limit the maximum number of messages per second to be processed the default value is zero, which means that there is no limit persistent storage when enabled, this will cause messages to undergo a store and forward procedure messages will be stored within litmus edge when cloud providers are online queue mode select the queue mode as lifo (last in first out) or fifo (first in first out) selecting lifo means that the last data entry is processed first, and selecting fifo means the first data entry is processed first step 3 enable the connector after adding the connector, click the toggle in the connector tile to enable it if you see a failed status, you can review the manage connectors docid 3u7jzldinehy8shvifd d and relevant error messages step 4 create inbound topic for connector you will now need to create a topic in litmus edge from the google cloud platform publication topic created in step 1 to create inbound topics navigate to integration click the connector tile click the topics tab click the add a new subscription icon the data integration dialog box appears configure the following parameters data direction select remote to local inbound local data topic enter a name for the topic name in litmus edge remote data topic copy and paste the publication topic from your google cloud platform enable select the toggle to enable the topic click yes to add the topic from the connector tile, ensure the connector is not disabled and still shows a connected status also verify the topic shows an enabled status step 5 send messages in google cloud platform start sending messages through the publication topic (created in step 1) from the google cloud platform see publish messages to topics to learn more step 6 verify connection in litmus edge you can do one of the following to verify the connection in litmus edge when configuring the flow or application, use the the local data topic name configured in step 4 create a flow docid\ veyyte7xdcangglzbqya0 to view the messages coming from google pub/sub through the connector you created visualize the incoming data using one of the dedicated applications docid\ yabkqsucfr461 ewjgrxf such as visualize data using grafana docid 5o vfup1zhzcebvrd1i62