DongyuanPan commented on code in PR #279: URL: https://github.com/apache/rocketmq-mqtt/pull/279#discussion_r1628718513
########## mqtt-cs/src/main/java/org/apache/rocketmq/mqtt/cs/channel/DefaultChannelManager.java: ########## @@ -177,4 +188,71 @@ public int totalConn() { return channelMap.size(); } + public boolean publishReceiveRefill(Channel channel) { Review Comment: These processing functions can be placed in the Session ########## mqtt-cs/src/main/java/org/apache/rocketmq/mqtt/cs/session/infly/PushAction.java: ########## @@ -181,6 +185,12 @@ public void write(Session session, Message message, int mqttId, int qos, Subscri data = MqttMessageFactory.buildPublishMessage(topicName, message.getPayload(), qos, retained, mqttId); break; case MQTT_5: + // Server send PublishMessage flow control + if (qos > 0 && !channelManager.publishSendTryAcquire(channel)) { + logger.error("publishSendTryAcquire failed, client:{}, message:{}", clientId, message); + return; + } Review Comment: If the push fails, there will be a retry, and the retry also requires flow control. ########## mqtt-cs/src/main/java/org/apache/rocketmq/mqtt/cs/channel/DefaultChannelManager.java: ########## @@ -47,6 +48,12 @@ public class DefaultChannelManager implements ChannelManager { private HashedWheelTimer hashedWheelTimer; private static int minBlankChannelSeconds = 10; private ScheduledThreadPoolExecutor scheduler; + // using to control publish-client's PUBLISH rate by MQTT-Server Receive Maximum Review Comment: Quota is related to the session and can be placed directly in the session without using map. -- 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: commits-unsubscr...@rocketmq.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org