添加服务器为客户缓存消息数量的配置

This commit is contained in:
imhao183
2019-12-03 08:10:38 +08:00
parent 5cd2e7affe
commit 994a8b5c4a
5 changed files with 15 additions and 2 deletions
+3
View File
@@ -58,6 +58,9 @@ message.roaming 0
##是否开启拉取远程历史消息 ##是否开启拉取远程历史消息
message.remote_history_message 0 message.remote_history_message 0
##服务器为每个用户缓存的消息数量
message.max_queue 1024
#********************************************************************* #*********************************************************************
# hazelcase configuration # hazelcase configuration
#********************************************************************* #*********************************************************************
@@ -115,6 +115,9 @@ public final class BrokerConstants {
public static final String MESSAGE_ROAMING = "message.roaming"; 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_Remote_History_Message = "message.remote_history_message";
public static final String MESSAGE_Max_Queue = "message.max_queue";
private BrokerConstants() { private BrokerConstants() {
} }
@@ -25,6 +25,7 @@ import com.hazelcast.util.StringUtil;
import com.xiaoleilu.loServer.model.FriendData; import com.xiaoleilu.loServer.model.FriendData;
import cn.wildfirechat.pojos.InputOutputUserBlockStatus; import cn.wildfirechat.pojos.InputOutputUserBlockStatus;
import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.common.ErrorCode;
import io.moquette.server.Constants;
import io.moquette.server.Server; import io.moquette.server.Server;
import io.moquette.spi.IMatchingCondition; import io.moquette.spi.IMatchingCondition;
import io.moquette.spi.IMessagesStore; import io.moquette.spi.IMessagesStore;
@@ -123,6 +124,7 @@ public class MemoryMessagesStore implements IMessagesStore {
this.databaseStore = databaseStore; this.databaseStore = databaseStore;
IS_MESSAGE_ROAMING = "1".equals(m_Server.getConfig().getProperty(MESSAGE_ROAMING)); 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)); 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 @Override
@@ -24,8 +24,10 @@ public final class Constants {
public static final String ATTR_CLIENTID = "ClientID"; public static final String ATTR_CLIENTID = "ClientID";
public static final String CLEAN_SESSION = "cleanSession"; public static final String CLEAN_SESSION = "cleanSession";
public static final String KEEP_ALIVE = "keepAlive"; 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() { private Constants() {
} }
@@ -49,6 +49,9 @@ message.roaming 0
##是否开启拉取远程历史消息 ##是否开启拉取远程历史消息
message.remote_history_message 0 message.remote_history_message 0
##服务器为每个用户缓存的消息数量
message.max_queue 1024
#********************************************************************* #*********************************************************************
# hazelcase configuration # hazelcase configuration
#********************************************************************* #*********************************************************************