node.js – Conflicting MQTT clientId when running application from multiple pods
When 1 of my 6 pods connected to the MQTT in AWS IoT Core another pod will also try to connect with the same clientId in the env config of the node server. This will lead to the disconnection and reconnection to the new pod. This event happens continuously, and the topic $aws/events/presence/connected/# received multiples messages in 1 second. This make the MQTT client unstable.

I tried to lock the connection of the MQTT client on just 1 pod by storing the status of the client connection in the database.
However, this leads to another problem that when I call an API to publish 1 topic using the MQTT client the API can not know which pod has the MQTT client connected.
Read more here: Source link

