One task for many MQTT topics or one task just only for one MQTT topic

hiik3n
Posts: 3
Joined: Wed Aug 30, 2017 8:02 am

One task for many MQTT topics or one task just only for one MQTT topic

Postby hiik3n » Wed Aug 30, 2017 9:08 am

Hi all,
I have many mqtt topics (around 5) to publish to (in the same broker). I wonder should I create one task for publishing to all mqtt topics or should I create one task for each mqtt topic?
As my understand, it should not create many task in RTOS. Anyone could give me some advice?
Thank you.

kurtzweber
Posts: 64
Joined: Tue Jan 10, 2017 1:09 pm

Re: One task for many MQTT topics or one task just only for one MQTT topic

Postby kurtzweber » Wed Aug 30, 2017 11:41 am

Hi!

"about 5" are not many tasks ;) anyway it depends on the "logic" you're going to use to send data to the topics... if you're going to read all the sensors (for example) and update all the topics every n seconds, you could use just one task to do all the job... but if you want to independently read/send data to MQ broker, you may find it easier to use different tasks, one for each sensor/topic.

Who is online

Users browsing this forum: tahseenabbas52 and 92 guests