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.
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.
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.