简体   繁体   中英

Publish to different pubsub topic in Google cloud via mosquitto broker?

I have a pubsub topic name

projects/project_name/topics/Sandbox_PubSub

and I also have a subscription on that topic. and then I have a cloud function name Sandbox_function which triggers with a publish on that topic.

I have a python code where I am publishing the data to this topic via a mosquitto broker

'/devices/device_id/events/Sandbox_PubSub'

Its working perfectly fine and I am receiving data in the cloud function as well as in the subscription.

Now I created another topic name

projects/project_name/topics/Pairing

and then subscription and another cloud function called Pairing_Function Now when I publish my data on

'/devices/device_id/events/Pairing'

Instead of getting that data in Pairing_Function I am getting the data in Sandbox_Function as a subFolder Pairing and also in Sandbox_Subscription instead of Pairing subscription.

What i am doing wrong here? and how can i get data into different topics? thanks a lot!

I found it that we need to define the topics in the registry too.

(see: IoT core -> Registry Edit -> Add more telemetry topics)

We need to redirect the subFolder to specific topics

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM