ActiveMq subscribed messages Delivered every time I connect with a new client ID

176 Views Asked by At

I am creating an iOS app in which I have used mosquito library for Integrating Active MQ.

Everything is working fine except,I get all the messages again when I reconnect with new client id.

cleanSession flag is set to false;

Any help would be appreciated.

1

There are 1 best solutions below

0
On

I suppose you are talking about a new client id for each time you connect?

Check the retain flag of the publish messages. If it is set to true the broker will retain the messages and since you are connecting with a new client id they would be sent to your client given that you subscribe to the certain topics.

Also to quote mosquitto.org about cleanSession.

If clean session is set to false, then the connection is treated as durable. This means that when the client disconnects, any subscriptions it has will remain and any subsequent QoS 1 or 2 messages will be stored until it connects again in the future.

I should say that the question seems a little ill-informed, would be better to have a better explanation for a better and spot on answer.