I am using paho.mqtt.client to read data from mqtt topic. Is there any way to publish data from multiple Mqtt topics to multiple Google Pubsub topics, ie mqtt_topic in Mqtt -> gcp_topic in Google cloud pubsub?
If you are using python then in order to send multiple messages to multiple topics using paho.mqtt you can use publish.multiple in python eg
msgs = [{'topic':"paho/test/multiple", 'payload':"multiple 1"},
("paho/test/multiple", "multiple 2", 0, False)]
publish.multiple(msgs, hostname="mqtt.eclipse.org")
for further information take a look at the official documentation:
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.