Commit 7b2511a7 by hweeeeeei

消息事件类型 封装枚举类;

优化代码,移除无用TODO;
parent b4774b23
...@@ -34,7 +34,7 @@ public class PushUtils { ...@@ -34,7 +34,7 @@ public class PushUtils {
} }
public static void main(String[] args) { public static void main(String[] args) {
// TODO set your appkey and master secret here // set your appkey and master secret here
PushUtils demo = new PushUtils("your appkey", "your master secret"); PushUtils demo = new PushUtils("your appkey", "your master secret");
try { try {
...@@ -52,7 +52,7 @@ public class PushUtils { ...@@ -52,7 +52,7 @@ public class PushUtils {
String body = "今日可能下雨🌂"; String body = "今日可能下雨🌂";
demo.sendIOSUnicast(deviceTokenIOS, titleIOS, subtitle, body); demo.sendIOSUnicast(deviceTokenIOS, titleIOS, subtitle, body);
/* TODO these methods are all available, just fill in some fields and do the test /* these methods are all available, just fill in some fields and do the test
* demo.sendAndroidCustomizedcastFile(); * demo.sendAndroidCustomizedcastFile();
* demo.sendAndroidBroadcast(); * demo.sendAndroidBroadcast();
* demo.sendAndroidGroupcast(); * demo.sendAndroidGroupcast();
...@@ -76,7 +76,7 @@ public class PushUtils { ...@@ -76,7 +76,7 @@ public class PushUtils {
broadcast.setText("Android broadcast text"); broadcast.setText("Android broadcast text");
broadcast.goAppAfterOpen(); broadcast.goAppAfterOpen();
broadcast.setDisplayType(AndroidNotification.DisplayType.NOTIFICATION); broadcast.setDisplayType(AndroidNotification.DisplayType.NOTIFICATION);
// TODO Set 'production_mode' to 'false' if it's a test device. // Set 'production_mode' to 'false' if it's a test device.
// For how to register a test device, please see the developer doc. // For how to register a test device, please see the developer doc.
broadcast.setProductionMode(); broadcast.setProductionMode();
// Set customized fields // Set customized fields
...@@ -98,7 +98,7 @@ public class PushUtils { ...@@ -98,7 +98,7 @@ public class PushUtils {
*/ */
public void sendAndroidUnicast(String deviceToken, String unicastText, String unicastTicker, String title) throws Exception { public void sendAndroidUnicast(String deviceToken, String unicastText, String unicastTicker, String title) throws Exception {
AndroidUnicast unicast = new AndroidUnicast(appkey, appMasterSecret); AndroidUnicast unicast = new AndroidUnicast(appkey, appMasterSecret);
// TODO Set your device token // Set your device token
unicast.setDeviceToken(deviceToken); unicast.setDeviceToken(deviceToken);
...@@ -108,7 +108,7 @@ public class PushUtils { ...@@ -108,7 +108,7 @@ public class PushUtils {
unicast.setText(unicastText); unicast.setText(unicastText);
unicast.goAppAfterOpen(); unicast.goAppAfterOpen();
unicast.setDisplayType(AndroidNotification.DisplayType.NOTIFICATION); unicast.setDisplayType(AndroidNotification.DisplayType.NOTIFICATION);
// TODO Set 'production_mode' to 'false' if it's a test device. // Set 'production_mode' to 'false' if it's a test device.
// For how to register a test device, please see the developer doc. // For how to register a test device, please see the developer doc.
unicast.setProductionMode(); unicast.setProductionMode();
// Set customized fields // Set customized fields
...@@ -120,7 +120,7 @@ public class PushUtils { ...@@ -120,7 +120,7 @@ public class PushUtils {
public void sendAndroidGroupcast() throws Exception { public void sendAndroidGroupcast() throws Exception {
AndroidGroupcast groupcast = new AndroidGroupcast(appkey, appMasterSecret); AndroidGroupcast groupcast = new AndroidGroupcast(appkey, appMasterSecret);
/* TODO /*
* Construct the filter condition: * Construct the filter condition:
* "where": * "where":
* { * {
...@@ -150,7 +150,7 @@ public class PushUtils { ...@@ -150,7 +150,7 @@ public class PushUtils {
groupcast.goAppAfterOpen(); groupcast.goAppAfterOpen();
groupcast.setDisplayType(AndroidNotification.DisplayType.NOTIFICATION); groupcast.setDisplayType(AndroidNotification.DisplayType.NOTIFICATION);
groupcast.setChannelActivity("your channel activity"); groupcast.setChannelActivity("your channel activity");
// TODO Set 'production_mode' to 'false' if it's a test device. // Set 'production_mode' to 'false' if it's a test device.
// For how to register a test device, please see the developer doc. // For how to register a test device, please see the developer doc.
groupcast.setProductionMode(); groupcast.setProductionMode();
//厂商通道相关参数 //厂商通道相关参数
...@@ -161,7 +161,7 @@ public class PushUtils { ...@@ -161,7 +161,7 @@ public class PushUtils {
public void sendAndroidCustomizedcast() throws Exception { public void sendAndroidCustomizedcast() throws Exception {
AndroidCustomizedcast customizedcast = new AndroidCustomizedcast(appkey, appMasterSecret); AndroidCustomizedcast customizedcast = new AndroidCustomizedcast(appkey, appMasterSecret);
// TODO Set your alias here, and use comma to split them if there are multiple alias. // Set your alias here, and use comma to split them if there are multiple alias.
// And if you have many alias, you can also upload a file containing these alias, then // And if you have many alias, you can also upload a file containing these alias, then
// use file_id to send customized notification. // use file_id to send customized notification.
customizedcast.setAlias("alias", "alias_type"); customizedcast.setAlias("alias", "alias_type");
...@@ -170,7 +170,7 @@ public class PushUtils { ...@@ -170,7 +170,7 @@ public class PushUtils {
customizedcast.setText("Android customizedcast text"); customizedcast.setText("Android customizedcast text");
customizedcast.goAppAfterOpen(); customizedcast.goAppAfterOpen();
customizedcast.setDisplayType(AndroidNotification.DisplayType.NOTIFICATION); customizedcast.setDisplayType(AndroidNotification.DisplayType.NOTIFICATION);
// TODO Set 'production_mode' to 'false' if it's a test device. // Set 'production_mode' to 'false' if it's a test device.
// For how to register a test device, please see the developer doc. // For how to register a test device, please see the developer doc.
customizedcast.setProductionMode(); customizedcast.setProductionMode();
//厂商通道相关参数 //厂商通道相关参数
...@@ -181,7 +181,7 @@ public class PushUtils { ...@@ -181,7 +181,7 @@ public class PushUtils {
public void sendAndroidCustomizedcastFile() throws Exception { public void sendAndroidCustomizedcastFile() throws Exception {
AndroidCustomizedcast customizedcast = new AndroidCustomizedcast(appkey, appMasterSecret); AndroidCustomizedcast customizedcast = new AndroidCustomizedcast(appkey, appMasterSecret);
// TODO Set your alias here, and use comma to split them if there are multiple alias. // Set your alias here, and use comma to split them if there are multiple alias.
// And if you have many alias, you can also upload a file containing these alias, then // And if you have many alias, you can also upload a file containing these alias, then
// use file_id to send customized notification. // use file_id to send customized notification.
String fileId = client.uploadContents(appkey, appMasterSecret, "aa" + "\n" + "bb" + "\n" + "alias"); String fileId = client.uploadContents(appkey, appMasterSecret, "aa" + "\n" + "bb" + "\n" + "alias");
...@@ -191,7 +191,7 @@ public class PushUtils { ...@@ -191,7 +191,7 @@ public class PushUtils {
customizedcast.setText("Android customizedcast text"); customizedcast.setText("Android customizedcast text");
customizedcast.goAppAfterOpen(); customizedcast.goAppAfterOpen();
customizedcast.setDisplayType(AndroidNotification.DisplayType.NOTIFICATION); customizedcast.setDisplayType(AndroidNotification.DisplayType.NOTIFICATION);
// TODO Set 'production_mode' to 'false' if it's a test device. // Set 'production_mode' to 'false' if it's a test device.
// For how to register a test device, please see the developer doc. // For how to register a test device, please see the developer doc.
customizedcast.setProductionMode(); customizedcast.setProductionMode();
//厂商通道相关参数 //厂商通道相关参数
...@@ -202,7 +202,7 @@ public class PushUtils { ...@@ -202,7 +202,7 @@ public class PushUtils {
public void sendAndroidFilecast() throws Exception { public void sendAndroidFilecast() throws Exception {
AndroidFilecast filecast = new AndroidFilecast(appkey, appMasterSecret); AndroidFilecast filecast = new AndroidFilecast(appkey, appMasterSecret);
// TODO upload your device tokens, and use '\n' to split them if there are multiple tokens // upload your device tokens, and use '\n' to split them if there are multiple tokens
String fileId = client.uploadContents(appkey, appMasterSecret, "aa" + "\n" + "bb"); String fileId = client.uploadContents(appkey, appMasterSecret, "aa" + "\n" + "bb");
filecast.setFileId(fileId); filecast.setFileId(fileId);
filecast.setTicker("Android filecast ticker"); filecast.setTicker("Android filecast ticker");
...@@ -224,7 +224,7 @@ public class PushUtils { ...@@ -224,7 +224,7 @@ public class PushUtils {
broadcast.setAlert("今日天气", "", "今日可能下雨🌂"); broadcast.setAlert("今日天气", "", "今日可能下雨🌂");
broadcast.setBadge(0); broadcast.setBadge(0);
broadcast.setSound("default"); broadcast.setSound("default");
// TODO set 'production_mode' to 'true' if your app is under production mode // set 'production_mode' to 'true' if your app is under production mode
broadcast.setTestMode(); broadcast.setTestMode();
// Set customized fields // Set customized fields
broadcast.setCustomizedField("test", "helloworld"); broadcast.setCustomizedField("test", "helloworld");
...@@ -243,7 +243,7 @@ public class PushUtils { ...@@ -243,7 +243,7 @@ public class PushUtils {
*/ */
public void sendIOSUnicast(String deviceToken, String title, String subtitle, String body) throws Exception { public void sendIOSUnicast(String deviceToken, String title, String subtitle, String body) throws Exception {
IOSUnicast unicast = new IOSUnicast(appkey, appMasterSecret); IOSUnicast unicast = new IOSUnicast(appkey, appMasterSecret);
// TODO Set your device token // Set your device token
unicast.setDeviceToken(deviceToken); unicast.setDeviceToken(deviceToken);
//alert值设置为字符串 //alert值设置为字符串
...@@ -253,7 +253,7 @@ public class PushUtils { ...@@ -253,7 +253,7 @@ public class PushUtils {
unicast.setAlert(title, subtitle, body); unicast.setAlert(title, subtitle, body);
unicast.setBadge(0); unicast.setBadge(0);
unicast.setSound("default"); unicast.setSound("default");
// TODO set 'production_mode' to 'true' if your app is under production mode // set 'production_mode' to 'true' if your app is under production mode
unicast.setTestMode(); unicast.setTestMode();
// Set customized fields // Set customized fields
unicast.setCustomizedField("test", "helloworld"); unicast.setCustomizedField("test", "helloworld");
...@@ -262,7 +262,7 @@ public class PushUtils { ...@@ -262,7 +262,7 @@ public class PushUtils {
public void sendIOSGroupcast() throws Exception { public void sendIOSGroupcast() throws Exception {
IOSGroupcast groupcast = new IOSGroupcast(appkey, appMasterSecret); IOSGroupcast groupcast = new IOSGroupcast(appkey, appMasterSecret);
/* TODO /*
* Construct the filter condition: * Construct the filter condition:
* "where": * "where":
* { * {
...@@ -289,14 +289,14 @@ public class PushUtils { ...@@ -289,14 +289,14 @@ public class PushUtils {
groupcast.setAlert("今日天气", "subtitle", "今日可能下雨🌂"); groupcast.setAlert("今日天气", "subtitle", "今日可能下雨🌂");
groupcast.setBadge(0); groupcast.setBadge(0);
groupcast.setSound("default"); groupcast.setSound("default");
// TODO set 'production_mode' to 'true' if your app is under production mode // set 'production_mode' to 'true' if your app is under production mode
groupcast.setTestMode(); groupcast.setTestMode();
client.send(groupcast); client.send(groupcast);
} }
public void sendIOSCustomizedcast() throws Exception { public void sendIOSCustomizedcast() throws Exception {
IOSCustomizedcast customizedcast = new IOSCustomizedcast(appkey, appMasterSecret); IOSCustomizedcast customizedcast = new IOSCustomizedcast(appkey, appMasterSecret);
// TODO Set your alias and alias_type here, and use comma to split them if there are multiple alias. // Set your alias and alias_type here, and use comma to split them if there are multiple alias.
// And if you have many alias, you can also upload a file containing these alias, then // And if you have many alias, you can also upload a file containing these alias, then
// use file_id to send customized notification. // use file_id to send customized notification.
customizedcast.setAlias("alias", "alias_type"); customizedcast.setAlias("alias", "alias_type");
...@@ -305,14 +305,14 @@ public class PushUtils { ...@@ -305,14 +305,14 @@ public class PushUtils {
customizedcast.setAlert("今日天气", "", "今日可能下雨🌂"); customizedcast.setAlert("今日天气", "", "今日可能下雨🌂");
customizedcast.setBadge(0); customizedcast.setBadge(0);
customizedcast.setSound("default"); customizedcast.setSound("default");
// TODO set 'production_mode' to 'true' if your app is under production mode // set 'production_mode' to 'true' if your app is under production mode
customizedcast.setTestMode(); customizedcast.setTestMode();
client.send(customizedcast); client.send(customizedcast);
} }
public void sendIOSFilecast() throws Exception { public void sendIOSFilecast() throws Exception {
IOSFilecast filecast = new IOSFilecast(appkey, appMasterSecret); IOSFilecast filecast = new IOSFilecast(appkey, appMasterSecret);
// TODO upload your device tokens, and use '\n' to split them if there are multiple tokens // upload your device tokens, and use '\n' to split them if there are multiple tokens
String fileId = client.uploadContents(appkey, appMasterSecret, "aa" + "\n" + "bb"); String fileId = client.uploadContents(appkey, appMasterSecret, "aa" + "\n" + "bb");
filecast.setFileId(fileId); filecast.setFileId(fileId);
//filecast.setAlert("IOS 文件播测试"); //filecast.setAlert("IOS 文件播测试");
...@@ -320,7 +320,7 @@ public class PushUtils { ...@@ -320,7 +320,7 @@ public class PushUtils {
filecast.setAlert("今日天气", "", "今日可能下雨🌂"); filecast.setAlert("今日天气", "", "今日可能下雨🌂");
filecast.setBadge(0); filecast.setBadge(0);
filecast.setSound("default"); filecast.setSound("default");
// TODO set 'production_mode' to 'true' if your app is under production mode // set 'production_mode' to 'true' if your app is under production mode
filecast.setTestMode(); filecast.setTestMode();
client.send(filecast); client.send(filecast);
} }
......
...@@ -121,7 +121,7 @@ public class ImConversationMembersServiceImpl extends BaseServiceImpl<ImConversa ...@@ -121,7 +121,7 @@ public class ImConversationMembersServiceImpl extends BaseServiceImpl<ImConversa
boolean b = imConversationMembersService.updateById(imConversationMember); boolean b = imConversationMembersService.updateById(imConversationMember);
if (b) { if (b) {
//TODO ws下发群成员属性变动事件 //TODO ws下发群成员备注变动事件
return ApiResult.ok(); return ApiResult.ok();
......
...@@ -30,6 +30,7 @@ import com.wecloud.im.service.ImMessageService; ...@@ -30,6 +30,7 @@ import com.wecloud.im.service.ImMessageService;
import com.wecloud.im.vo.ImConversationCreateVo; import com.wecloud.im.vo.ImConversationCreateVo;
import com.wecloud.im.vo.MyConversationListVo; import com.wecloud.im.vo.MyConversationListVo;
import com.wecloud.im.vo.OfflineMsgDto; import com.wecloud.im.vo.OfflineMsgDto;
import com.wecloud.im.ws.enums.MsgTypeEnum;
import com.wecloud.im.ws.enums.WsResponseCmdEnum; import com.wecloud.im.ws.enums.WsResponseCmdEnum;
import com.wecloud.im.ws.model.WsResponseModel; import com.wecloud.im.ws.model.WsResponseModel;
import com.wecloud.im.ws.service.WriteDataService; import com.wecloud.im.ws.service.WriteDataService;
...@@ -284,11 +285,10 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap ...@@ -284,11 +285,10 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
Map<String, Object> content = new HashMap<>(); Map<String, Object> content = new HashMap<>();
content.put("operator", imClientSender.getClientId()); //操作的client ID content.put("operator", imClientSender.getClientId()); //操作的client ID
content.put("passivityOperator", client2.getClientId()); //被操作的client ID content.put("passivityOperator", client2.getClientId()); //被操作的client ID
content.put("type", -1007); //xx邀请xx加入会话 -1007 content.put("type", MsgTypeEnum.INVITE_CLIENT_JOIN_CONVERSATION.getUriCode()); //xx邀请xx加入会话 -1007
try { try {
String asString = JSON_MAPPER.writeValueAsString(content); String contentString = JSON_MAPPER.writeValueAsString(content);
imMessage.setContent(asString); imMessage.setContent(contentString);
} catch (JsonProcessingException e) { } catch (JsonProcessingException e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -401,7 +401,7 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap ...@@ -401,7 +401,7 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
Map<String, Object> content = new HashMap<>(); Map<String, Object> content = new HashMap<>();
content.put("operator", imClientSender.getClientId()); //操作的client ID content.put("operator", imClientSender.getClientId()); //操作的client ID
content.put("passivityOperator", client2.getClientId()); //被操作的client ID content.put("passivityOperator", client2.getClientId()); //被操作的client ID
content.put("type", -1008); //xx被xx移出会话 -1008 content.put("type", MsgTypeEnum.REMOVE_CLIENT_CONVERSATION.getUriCode()); //xx被xx移出会话 -1008
try { try {
String asString = JSON_MAPPER.writeValueAsString(content); String asString = JSON_MAPPER.writeValueAsString(content);
imMessage.setContent(asString); imMessage.setContent(asString);
...@@ -510,7 +510,7 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap ...@@ -510,7 +510,7 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
ImMessage imMessage = new ImMessage(); ImMessage imMessage = new ImMessage();
Map<String, Object> content = new HashMap<>(); Map<String, Object> content = new HashMap<>();
content.put("type", -1012); // xx主动退出会话 content.put("type", MsgTypeEnum.LEAVE_CONVERSATION.getUriCode()); // xx主动退出会话
try { try {
String asString = JSON_MAPPER.writeValueAsString(content); String asString = JSON_MAPPER.writeValueAsString(content);
imMessage.setContent(asString); imMessage.setContent(asString);
......
...@@ -15,6 +15,7 @@ import com.wecloud.im.service.ImClientService; ...@@ -15,6 +15,7 @@ import com.wecloud.im.service.ImClientService;
import com.wecloud.im.service.ImConversationMembersService; import com.wecloud.im.service.ImConversationMembersService;
import com.wecloud.im.service.ImInboxService; import com.wecloud.im.service.ImInboxService;
import com.wecloud.im.service.ImMessageService; import com.wecloud.im.service.ImMessageService;
import com.wecloud.im.ws.enums.MsgTypeEnum;
import com.wecloud.im.ws.enums.WsResponseCmdEnum; import com.wecloud.im.ws.enums.WsResponseCmdEnum;
import com.wecloud.im.ws.model.WsResponseModel; import com.wecloud.im.ws.model.WsResponseModel;
import com.wecloud.im.ws.service.WriteDataService; import com.wecloud.im.ws.service.WriteDataService;
...@@ -101,7 +102,7 @@ public class ImInboxServiceImpl extends BaseServiceImpl<ImInboxMapper, ImInbox> ...@@ -101,7 +102,7 @@ public class ImInboxServiceImpl extends BaseServiceImpl<ImInboxMapper, ImInbox>
// 内容 // 内容
HashMap<String, String> stringStringHashMap = new HashMap<>(); HashMap<String, String> stringStringHashMap = new HashMap<>();
stringStringHashMap.put("type", "-1009"); stringStringHashMap.put("type", MsgTypeEnum.CLIENT_RECEIVED_MSG.getUriCode() + "");
stringStringHashMap.put("receiverId", curentClient.getClientId()); stringStringHashMap.put("receiverId", curentClient.getClientId());
// 推送给接收方 // 推送给接收方
...@@ -144,7 +145,7 @@ public class ImInboxServiceImpl extends BaseServiceImpl<ImInboxMapper, ImInbox> ...@@ -144,7 +145,7 @@ public class ImInboxServiceImpl extends BaseServiceImpl<ImInboxMapper, ImInbox>
// 内容 // 内容
HashMap<String, String> stringStringHashMap = new HashMap<>(); HashMap<String, String> stringStringHashMap = new HashMap<>();
stringStringHashMap.put("type", "-1010"); stringStringHashMap.put("type", MsgTypeEnum.CLIENT_READ_MSG + "");
stringStringHashMap.put("receiverId", curentClient.getClientId()); stringStringHashMap.put("receiverId", curentClient.getClientId());
sendMsgStatus(curentClient, application, stringStringHashMap, imMsgReadStatusUpdate.getMsgIds()); sendMsgStatus(curentClient, application, stringStringHashMap, imMsgReadStatusUpdate.getMsgIds());
......
package com.wecloud.im.ws.enums;
/**
* @Description ws响应类型
* @Author xxxname xxxemail.com
* @Date 2019-12-05
*/
public enum MsgTypeEnum {
// xx邀请xx加入会话 -1007
INVITE_CLIENT_JOIN_CONVERSATION(-1007),
// xx被xx移出会话 -1008
REMOVE_CLIENT_CONVERSATION(-1008),
// xx已接收某消息 -1009
CLIENT_RECEIVED_MSG(-1009),
// xx已读某条消息 -1010
CLIENT_READ_MSG(-1010),
// 你被xx拉入新会话 -1011
CLIENT_JOIN_NEW_CONVERSATION(-1011),
// 主动退出会话 -1012
LEAVE_CONVERSATION(-1012),
// 成为新群主 -1013
CONVERSATION_NEW_CREATOR(-1013),
;
private final int uriCode;
MsgTypeEnum(int uriCode) {
this.uriCode = uriCode;
}
/**
* 根据uriCode获取
*
* @param uriCode
* @return
*/
public static MsgTypeEnum getByCode(int uriCode) {
for (MsgTypeEnum wsResponsePathEnum : values()) {
if (wsResponsePathEnum.getUriCode() == uriCode) {
return wsResponsePathEnum;
}
}
return null;
}
public int getUriCode() {
return uriCode;
}
}
package com.wecloud.im.ws.enums;
/**
* @Description ws响应类型
* @Author hewei hwei1233@163.com
* @Date 2019-12-05
*/
public enum WsResponseEventEnum {
// - xx邀请xx加入会话 -1007
// - xx被xx移出会话 -1008
// - xx已接收某消息 -1009
// - xx已读某条消息 -1010
// - 你被xx拉入新会话 -1011
// - xx主动退出会话 -1012
// - xx成为新群主 -1013
/**
* 响应数据类型
*/
RES(1);
private final int cmdCode;
WsResponseEventEnum(int uriCode) {
this.cmdCode = uriCode;
}
public int getCmdCode() {
return cmdCode;
}
}
...@@ -32,7 +32,7 @@ public class MangerChannelServiceImpl implements MangerChannelService { ...@@ -32,7 +32,7 @@ public class MangerChannelServiceImpl implements MangerChannelService {
* <p> * <p>
* 由于来自远程端调用下发数据 如果是群聊1000人群则调用1000次 为不要占用太多资源 需要排队下发 * 由于来自远程端调用下发数据 如果是群聊1000人群则调用1000次 为不要占用太多资源 需要排队下发
* 经过并发测试 200并发1000人群消息 需要调用200x1000=20w次 考虑单机cpu性能还要顾及本机api业务 设置阻塞队列 * 经过并发测试 200并发1000人群消息 需要调用200x1000=20w次 考虑单机cpu性能还要顾及本机api业务 设置阻塞队列
* 为避免过多占用本地io线程导致response慢,设置LinkedBlockingQueue数量多可以避免抢占,TODO (队列数量需要测试调试到最优数量 ) * 为避免过多占用本地io线程导致response慢,设置LinkedBlockingQueue数量多可以避免抢占, (队列数量需要测试调试到最优数量 )
* 最大线程数量不要设置太多 数量、优先级一定要比本地io线程低级 * 最大线程数量不要设置太多 数量、优先级一定要比本地io线程低级
* *
* *
...@@ -108,8 +108,8 @@ public class MangerChannelServiceImpl implements MangerChannelService { ...@@ -108,8 +108,8 @@ public class MangerChannelServiceImpl implements MangerChannelService {
// //
// //
// /** // /**
// * TODO 待完成: 根据ACK回执 以及线程等待超时机制来判断客户端是否离线和超时; // * 待完成: 根据ACK回执 以及线程等待超时机制来判断客户端是否离线和超时;
// * TODO 待完成: 发送后阻塞当前子线程2秒后获取ack回执 如客户端发起ack回执则需要主动唤醒当前子线程 立马唤醒当前子线程, 判断如果已回执则返回发送成功, 如果未回执则判断客户端是否断线或发送错误 // * 待完成: 发送后阻塞当前子线程2秒后获取ack回执 如客户端发起ack回执则需要主动唤醒当前子线程 立马唤醒当前子线程, 判断如果已回执则返回发送成功, 如果未回执则判断客户端是否断线或发送错误
// * // *
// * @param msg // * @param msg
// * @param userId // * @param userId
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment