diff --git a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTPublishManager.java b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTPublishManager.java index 76f15c0938..f0385dc63d 100644 --- a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTPublishManager.java +++ b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTPublishManager.java @@ -161,7 +161,12 @@ public class MQTTPublishManager { Transaction tx = session.getServerSession().newTransaction(); try { - session.getServerSession().send(tx, serverMessage, true, false); + if (internal) { + session.getServer().getPostOffice().route(serverMessage, tx, true); + } else { + session.getServerSession().send(tx, serverMessage, true, false); + } + if (retain) { boolean reset = payload instanceof EmptyByteBuf || payload.capacity() == 0; session.getRetainMessageManager().handleRetainedMessage(serverMessage, topic, reset, tx);