作者 钟来

初始提交

@@ -45,7 +45,7 @@ cim.server.online.user.url=http://localhost:8083/onlineUser @@ -45,7 +45,7 @@ cim.server.online.user.url=http://localhost:8083/onlineUser
45 cim.clear.route.request.url=http://localhost:8083/offLine 45 cim.clear.route.request.url=http://localhost:8083/offLine
46 46
47 # 客户端唯一ID 47 # 客户端唯一ID
48 -cim.user.id=1586617710861 48 +cim.user.id=1587956244882
49 cim.user.userName=zhangsan 49 cim.user.userName=zhangsan
50 50
51 # 回调线程队列大小 51 # 回调线程队列大小
@@ -29,7 +29,6 @@ public class NettyAttrUtil { @@ -29,7 +29,6 @@ public class NettyAttrUtil {
29 return null; 29 return null;
30 } 30 }
31 31
32 -  
33 private static String getAttribute(Channel channel, AttributeKey<String> key) { 32 private static String getAttribute(Channel channel, AttributeKey<String> key) {
34 Attribute<String> attr = channel.attr(key); 33 Attribute<String> attr = channel.attr(key);
35 return attr.get(); 34 return attr.get();
@@ -13,7 +13,7 @@ logging.level.root=info @@ -13,7 +13,7 @@ logging.level.root=info
13 management.security.enabled=false 13 management.security.enabled=false
14 14
15 # zk 地址 15 # zk 地址
16 -app.zk.addr=ip:port 16 +app.zk.addr=118.25.173.200:9528
17 17
18 # zk 连接超时时限 18 # zk 连接超时时限
19 app.zk.connect.timeout=15000 19 app.zk.connect.timeout=15000
@@ -37,11 +37,11 @@ app.route.way=com.crossoverjie.cim.common.route.algorithm.consistenthash.Consist @@ -37,11 +37,11 @@ app.route.way=com.crossoverjie.cim.common.route.algorithm.consistenthash.Consist
37 app.route.way.consitenthash=com.crossoverjie.cim.common.route.algorithm.consistenthash.TreeMapConsistentHash 37 app.route.way.consitenthash=com.crossoverjie.cim.common.route.algorithm.consistenthash.TreeMapConsistentHash
38 38
39 # Redis 配置 39 # Redis 配置
40 -spring.redis.host=xx  
41 -spring.redis.port=6379 40 +spring.redis.host=118.25.173.200
  41 +spring.redis.port=9527
42 spring.redis.pool.max-active=100 42 spring.redis.pool.max-active=100
43 spring.redis.pool.max-idle=100 43 spring.redis.pool.max-idle=100
44 spring.redis.pool.max-wait=1000 44 spring.redis.pool.max-wait=1000
45 spring.redis.pool.min-idle=10 45 spring.redis.pool.min-idle=10
46 -spring.redis.password=xx 46 +spring.redis.password=Luhui586
47 47
@@ -77,24 +77,24 @@ public class CIMServer { @@ -77,24 +77,24 @@ public class CIMServer {
77 } 77 }
78 78
79 79
80 - /**  
81 - * 发送 Google Protocol 编码消息  
82 - * @param sendMsgReqVO 消息  
83 - */  
84 - public void sendMsg(SendMsgReqVO sendMsgReqVO){  
85 - NioSocketChannel socketChannel = SessionSocketHolder.get(sendMsgReqVO.getUserId());  
86 -  
87 - if (null == socketChannel) {  
88 - LOGGER.error("client {} offline!", sendMsgReqVO.getUserId()); 80 + /**
  81 + * 发送 Google Protocol 编码消息
  82 + * @param sendMsgReqVO 消息
  83 + */
  84 + public void sendMsg(SendMsgReqVO sendMsgReqVO){
  85 + NioSocketChannel socketChannel = SessionSocketHolder.get(sendMsgReqVO.getUserId());
  86 +
  87 + if (null == socketChannel) {
  88 + LOGGER.error("client {} offline!", sendMsgReqVO.getUserId());
  89 + }
  90 + CIMRequestProto.CIMReqProtocol protocol = CIMRequestProto.CIMReqProtocol.newBuilder()
  91 + .setRequestId(sendMsgReqVO.getUserId())
  92 + .setReqMsg(sendMsgReqVO.getMsg())
  93 + .setType(Constants.CommandType.MSG)
  94 + .build();
  95 +
  96 + ChannelFuture future = socketChannel.writeAndFlush(protocol);
  97 + future.addListener((ChannelFutureListener) channelFuture ->
  98 + LOGGER.info("server push msg:[{}]", sendMsgReqVO.toString()));
89 } 99 }
90 - CIMRequestProto.CIMReqProtocol protocol = CIMRequestProto.CIMReqProtocol.newBuilder()  
91 - .setRequestId(sendMsgReqVO.getUserId())  
92 - .setReqMsg(sendMsgReqVO.getMsg())  
93 - .setType(Constants.CommandType.MSG)  
94 - .build();  
95 -  
96 - ChannelFuture future = socketChannel.writeAndFlush(protocol);  
97 - future.addListener((ChannelFutureListener) channelFuture ->  
98 - LOGGER.info("server push msg:[{}]", sendMsgReqVO.toString()));  
99 - }  
100 } 100 }
@@ -57,6 +57,7 @@ public class SessionSocketHolder { @@ -57,6 +57,7 @@ public class SessionSocketHolder {
57 } 57 }
58 } 58 }
59 59
  60 +
60 return null; 61 return null;
61 } 62 }
62 63
@@ -25,7 +25,7 @@ monitor.channel.map.key=channelMap @@ -25,7 +25,7 @@ monitor.channel.map.key=channelMap
25 app.zk.switch=true 25 app.zk.switch=true
26 26
27 # zk 地址 27 # zk 地址
28 -app.zk.addr=ip:port 28 +app.zk.addr=118.25.173.200:9528
29 29
30 # zk 连接超时时限 30 # zk 连接超时时限
31 app.zk.connect.timeout=15000 31 app.zk.connect.timeout=15000
@@ -17,6 +17,12 @@ @@ -17,6 +17,12 @@
17 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 17 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
18 <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> 18 <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
19 <swagger.version>2.5.0</swagger.version> 19 <swagger.version>2.5.0</swagger.version>
  20 +
  21 + <java.version>1.8</java.version>
  22 + <!--这里需要注意的是maven.test.skip, 不生成test的所有.class,skipTests会编译测试类,即生成.class文件,只是不运行测试类-->
  23 + <maven.test.skip>true</maven.test.skip>
  24 + <!--打包时跳过Junit测试-->
  25 + <!--<skipTests>true</skipTests>-->
20 </properties> 26 </properties>
21 27
22 <parent> 28 <parent>