HiveMQ

Nodejs Cluster with MQTT client

I have a nodejs engine that uses MQTT to subscribe to messages from many IoT devices. As the number of IoT devices has increased, I want to run the nodejs engine in a cluster mode. This results in every cluster receiving all the MQTT messages. Is there a way to avoid this? A way in which one MQTT message will be received only once and the load of servicing the messages can be equally distributed.
Setup:
Nodejs Engine with MQTT client running via pm2 in an EC2 instance.
MQTT broker running in another EC2 instance.

Hi @ambaradhikari,

Sounds like you are looking to use Shared Subscriptions.
An MQTT 5 mechanism specifically designed for client load balancing.

Best,
Florian