Skip to content

Commit

Permalink
添加服务器为客户缓存消息数量的配置
Browse files Browse the repository at this point in the history
  • Loading branch information
imhao183 committed Dec 3, 2019
1 parent 5cd2e7a commit 994a8b5
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
3 changes: 3 additions & 0 deletions broker/config/wildfirechat.conf
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ message.roaming 0
##是否开启拉取远程历史消息
message.remote_history_message 0

##服务器为每个用户缓存的消息数量
message.max_queue 1024

#*********************************************************************
# hazelcase configuration
#*********************************************************************
Expand Down
3 changes: 3 additions & 0 deletions broker/src/main/java/io/moquette/BrokerConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ public final class BrokerConstants {
public static final String MESSAGE_ROAMING = "message.roaming";
public static final String MESSAGE_Remote_History_Message = "message.remote_history_message";

public static final String MESSAGE_Max_Queue = "message.max_queue";



private BrokerConstants() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.xiaoleilu.loServer.model.FriendData;
import cn.wildfirechat.pojos.InputOutputUserBlockStatus;
import cn.wildfirechat.common.ErrorCode;
import io.moquette.server.Constants;
import io.moquette.server.Server;
import io.moquette.spi.IMatchingCondition;
import io.moquette.spi.IMessagesStore;
Expand Down Expand Up @@ -123,6 +124,7 @@ public class MemoryMessagesStore implements IMessagesStore {
this.databaseStore = databaseStore;
IS_MESSAGE_ROAMING = "1".equals(m_Server.getConfig().getProperty(MESSAGE_ROAMING));
IS_MESSAGE_REMOTE_HISTORY_MESSAGE = "1".equals(m_Server.getConfig().getProperty(MESSAGE_Remote_History_Message));
Constants.MAX_MESSAGE_QUEUE = Integer.parseInt(m_Server.getConfig().getProperty(MESSAGE_Max_Queue));
}

@Override
Expand Down
6 changes: 4 additions & 2 deletions broker/src/main/java/io/moquette/server/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ public final class Constants {
public static final String ATTR_CLIENTID = "ClientID";
public static final String CLEAN_SESSION = "cleanSession";
public static final String KEEP_ALIVE = "keepAlive";
public static final int MAX_MESSAGE_QUEUE = 1024; // number of messages
public static final int MAX_CHATROOM_MESSAGE_QUEUE = 256; // number of chatroom messages


public static int MAX_MESSAGE_QUEUE = 1024; // number of messages
public static int MAX_CHATROOM_MESSAGE_QUEUE = 256; // number of chatroom messages

private Constants() {
}
Expand Down
3 changes: 3 additions & 0 deletions distribution/src/main/resources/wildfirechat.conf
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ message.roaming 0
##是否开启拉取远程历史消息
message.remote_history_message 0

##服务器为每个用户缓存的消息数量
message.max_queue 1024

#*********************************************************************
# hazelcase configuration
#*********************************************************************
Expand Down

0 comments on commit 994a8b5

Please sign in to comment.