Aias00 opened a new issue, #6849: URL: https://github.com/apache/shenyu/issues/6849
## Description `TopicRepository.add(topic, message)` is called unconditionally for every inbound PUBLISH regardless of the retain bit (module-wide grep for `isRetain`/`retain` returns zero hits). A zero-byte retained PUBLISH should delete the retained message — that never happens. ## Location - `shenyu-protocol/shenyu-protocol-mqtt/src/main/java/org/apache/shenyu/protocol/mqtt/Publish.java:55` - `shenyu-protocol/shenyu-protocol-mqtt/src/main/java/org/apache/shenyu/protocol/mqtt/repositories/TopicRepository.java:34-37` ## Impact Non-retained messages are persisted and redelivered to future subscribers as if they were retained (via `Subscribe.sendSubMessage` at `Subscribe.java:72-77`, which sends with `retain=true`). Violates MQTT-3.3.1. ## Suggested fix Read `msg.fixedHeader().isRetain()`; only call `TopicRepository.add` when retain is true; on a zero-byte retained PUBLISH, call `TopicRepository.remove(topic)`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
