Github user onlyMIT commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/2491#discussion_r246095670 --- Diff: artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTSession.java --- @@ -117,14 +118,11 @@ boolean getStopped() { } boolean isClean() { - return isClean; + return clean; } - void setIsClean(boolean isClean) throws Exception { - this.isClean = isClean; - if (isClean) { - clean(); - } + void setClean(boolean clean) throws Exception { + this.clean = clean; --- End diff -- @jbertram in the getSessionState method.Only clear stateï¼not call 'clean()' method. In fact, the queue is not cleaned up. I use the code for the âpahoâ test. The first consumer "cleanSession=false", using a different clientID to open a producer to send a message. Close the producer and consumer, use the same clientID and cleanSession = true" to open the second consumer and find that the consumer will consume the legacy message in the queueãSo I suspect that there is a problem with the test code. I am always looking for why my test results will consume the legacy messages in the queue, and your test results will notã After seeing your information, I re-reviewed the code and found that the test code did not have any problems. What is causing my doubts is that because of your change, when cleanSession=true, only the MQTTSessionState is cleaned up, the queue still exists, and the legacy messages in the queue are consumed when resubscribing. Can close [#2493 ](https://github.com/apache/activemq-artemis/pull/2493) . I think you need to review your changeã
---