Bridge data to GCP PubSub
EMQX GCP PubSub integration can send MQTT messages and events to Google Cloud PubSub (opens new window), which can help you flexibly choose services on Google Cloud and build IoT applications more easily.
The following steps will guide you to use this configuration.
TIP
Introduced in
- Create a Service Account
(opens new window) in your GCP account. Ensure that the Service Account has permissions to at least publish messages to the topic of interest.
- Create a PubSub topic (remember that the Service Account must have permissions to publish to that topic).
Go to EMQX Dashboard (opens new window), select the “Rule Engine” item on the menu to the left, then “Resources”. Then, click “Create”.
Go to EMQX Dashboard (opens new window), select the “Rule Engine” item on the menu to the left, then “Rule”. Then, click “Create”.
Type in the following SQL:
Then, click on “Add Action”. Select the Action Type “Data Forward”, “Data to GCP PubSub” and in “Use of resources” select the GCP PubSub resource previously created. Fill in the parameters for the action. The only required parameter to define here is the PubSub Topic where the messages should be forwarded to. Click “Confirm”.
Finally, click “Create” at the bottom of the page.
You can test the new Action by sending a MQTT message to EMQX:
You may check that the metrics have increase for that rule with the successful publishing.
By pulling the messages from the PubSub topic, you can verify that the data has been forwarded to GCP.