作者 钟来

初始提交

... ... @@ -45,7 +45,7 @@ cim.server.online.user.url=http://localhost:8083/onlineUser
cim.clear.route.request.url=http://localhost:8083/offLine
# 客户端唯一ID
cim.user.id=1586617710861
cim.user.id=1587956244882
cim.user.userName=zhangsan
# 回调线程队列大小
... ...
... ... @@ -29,7 +29,6 @@ public class NettyAttrUtil {
return null;
}
private static String getAttribute(Channel channel, AttributeKey<String> key) {
Attribute<String> attr = channel.attr(key);
return attr.get();
... ...
... ... @@ -13,7 +13,7 @@ logging.level.root=info
management.security.enabled=false
# zk 地址
app.zk.addr=ip:port
app.zk.addr=118.25.173.200:9528
# zk 连接超时时限
app.zk.connect.timeout=15000
... ... @@ -37,11 +37,11 @@ app.route.way=com.crossoverjie.cim.common.route.algorithm.consistenthash.Consist
app.route.way.consitenthash=com.crossoverjie.cim.common.route.algorithm.consistenthash.TreeMapConsistentHash
# Redis 配置
spring.redis.host=xx
spring.redis.port=6379
spring.redis.host=118.25.173.200
spring.redis.port=9527
spring.redis.pool.max-active=100
spring.redis.pool.max-idle=100
spring.redis.pool.max-wait=1000
spring.redis.pool.min-idle=10
spring.redis.password=xx
spring.redis.password=Luhui586
... ...
... ... @@ -77,24 +77,24 @@ public class CIMServer {
}
/**
* 发送 Google Protocol 编码消息
* @param sendMsgReqVO 消息
*/
public void sendMsg(SendMsgReqVO sendMsgReqVO){
NioSocketChannel socketChannel = SessionSocketHolder.get(sendMsgReqVO.getUserId());
if (null == socketChannel) {
LOGGER.error("client {} offline!", sendMsgReqVO.getUserId());
/**
* 发送 Google Protocol 编码消息
* @param sendMsgReqVO 消息
*/
public void sendMsg(SendMsgReqVO sendMsgReqVO){
NioSocketChannel socketChannel = SessionSocketHolder.get(sendMsgReqVO.getUserId());
if (null == socketChannel) {
LOGGER.error("client {} offline!", sendMsgReqVO.getUserId());
}
CIMRequestProto.CIMReqProtocol protocol = CIMRequestProto.CIMReqProtocol.newBuilder()
.setRequestId(sendMsgReqVO.getUserId())
.setReqMsg(sendMsgReqVO.getMsg())
.setType(Constants.CommandType.MSG)
.build();
ChannelFuture future = socketChannel.writeAndFlush(protocol);
future.addListener((ChannelFutureListener) channelFuture ->
LOGGER.info("server push msg:[{}]", sendMsgReqVO.toString()));
}
CIMRequestProto.CIMReqProtocol protocol = CIMRequestProto.CIMReqProtocol.newBuilder()
.setRequestId(sendMsgReqVO.getUserId())
.setReqMsg(sendMsgReqVO.getMsg())
.setType(Constants.CommandType.MSG)
.build();
ChannelFuture future = socketChannel.writeAndFlush(protocol);
future.addListener((ChannelFutureListener) channelFuture ->
LOGGER.info("server push msg:[{}]", sendMsgReqVO.toString()));
}
}
... ...
... ... @@ -57,6 +57,7 @@ public class SessionSocketHolder {
}
}
return null;
}
... ...
... ... @@ -25,7 +25,7 @@ monitor.channel.map.key=channelMap
app.zk.switch=true
# zk 地址
app.zk.addr=ip:port
app.zk.addr=118.25.173.200:9528
# zk 连接超时时限
app.zk.connect.timeout=15000
... ...
... ... @@ -17,6 +17,12 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<swagger.version>2.5.0</swagger.version>
<java.version>1.8</java.version>
<!--这里需要注意的是maven.test.skip, 不生成test的所有.class,skipTests会编译测试类,即生成.class文件,只是不运行测试类-->
<maven.test.skip>true</maven.test.skip>
<!--打包时跳过Junit测试-->
<!--<skipTests>true</skipTests>-->
</properties>
<parent>
... ...