Skip to content

Commit 8a85438

Browse files
authored
Merge pull request #12 from libxengine/develop
V3.5.0.1001 Merge
2 parents fa090c7 + 4dd3960 commit 8a85438

31 files changed

+1220
-393
lines changed

CHANGELOG

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,31 @@
1+
XEngine_MQService V3.5.0.1001
2+
3+
增加:未读消息协议处理支持
4+
增加:主题名称修改功能
5+
增加:修改消息功能
6+
修改:tcp,http,websocket获取任务方法
7+
修改:移动定时发布任务表到user数据库
8+
修改:定时任务表名称为UserTime
9+
修改:http请求现在会响应数据了
10+
修改:协议定义不正确的问题
11+
修改:扩展tcp task 发送缓冲区大小
12+
修复:获取错误码不正确
13+
修复:http解析的时候可以不解析所有mq协议字段了
14+
修复:key list释放内存不正确的问题
15+
16+
added:unread message protocol process support
17+
added:topic name modify function
18+
added:modify message support
19+
modify:get task method for tcp and http and websocket
20+
modify:move time-release table to user from data
21+
modify:time-release table name to UserTime
22+
modify:http request will be responese now
23+
modify:protocol define is incorrent
24+
modify:extend size for tcp task send buffer
25+
fixed:get error code
26+
fixed:http parse can be done without parse all mqprotocol fields
27+
fixed:key list free memory is incorrent
28+
======================================================================================
129
XEngine_MQService V3.4.0.1001
230

331
添加:为数据库表添加数据类型字段

README.en.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ this software support following features
3434
## install
3535

3636
#### XEngine Evn
37-
you must install XEngine,need V7.38 or above,install XEngine can be refer to xengine Readme docment
37+
you must install XEngine,need V7.46 or above,install XEngine can be refer to xengine Readme docment
3838
GITEE:https://gitee.com/xyry/libxengine
3939
GITHUB:https://github.com/libxengine/xengine
4040

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ c c++Message Service
3333
## 安装教程
3434

3535
#### XEngine环境
36-
必须安装XEngine,版本需要V7.38或者以上版本,安装XEngine可以参考其Readme文档
36+
必须安装XEngine,版本需要V7.46或者以上版本,安装XEngine可以参考其Readme文档
3737
GITEE:https://gitee.com/xyry/libxengine
3838
GITHUB:https://github.com/libxengine/xengine
3939

@@ -101,13 +101,16 @@ make FLAGS=CleanAll 清理编译
101101
## 开发计划
102102
扩展获取消息的内容
103103
数据库缓存功能
104-
消息编辑
105104
用户消息
106105
消息属性生效
107106
公众号和小程序
108-
消息强推送
107+
消息强推送(不限订阅,强制推送)
108+
QOS(支持强回复确认)
109109
功能开关
110110
MQTT支持
111+
支持时区设置
112+
完善消息订阅(永存)
113+
完善HTTP_CALL
111114

112115
## 提交问题
113116

XEngine_Apps/MQCore_HTTPApp/MQCore_HTTPApp.cpp

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,34 @@ void MQ_Authorize()
6969
}
7070
BaseLib_OperatorMemory_FreeCStyle((XPPMEM)&ptszMsgBody);
7171
}
72+
void MQ_UNRead()
73+
{
74+
int nLen = 0;
75+
TCHAR tszMsgBuffer[2048];
76+
memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer));
77+
78+
Json::Value st_JsonRoot;
79+
Json::Value st_JsonMQProtocol;
80+
st_JsonRoot["unOperatorType"] = ENUM_XENGINE_COMMUNICATION_PROTOCOL_TYPE_XMQ;
81+
st_JsonRoot["unOperatorCode"] = XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_MQ_REQUNREAD;
82+
st_JsonRoot["byVersion"] = ENUM_XENGINE_PROTOCOLHDR_PAYLOAD_TYPE_JSON;
83+
st_JsonRoot["xhToken"] = xhToken;
84+
85+
st_JsonMQProtocol["tszMQKey"] = ""; //所有未读
86+
st_JsonRoot["st_MQProtocol"] = st_JsonMQProtocol;
87+
88+
nLen = st_JsonRoot.toStyledString().length();
89+
memcpy(tszMsgBuffer, st_JsonRoot.toStyledString().c_str(), nLen);
7290

91+
TCHAR* ptszMsgBody = NULL;
92+
if (!APIHelp_HttpRequest_Custom(_T("POST"), lpszPostUrl, tszMsgBuffer, NULL, &ptszMsgBody))
93+
{
94+
printf("发送投递失败!\n");
95+
return;
96+
}
97+
printf("MQ_Create:%s\n", ptszMsgBody);
98+
BaseLib_OperatorMemory_FreeCStyle((XPPMEM)&ptszMsgBody);
99+
}
73100
void MQ_Create()
74101
{
75102
int nLen = 0;
@@ -198,6 +225,110 @@ void MQ_Get()
198225
printf("MQ_Get:%s\n", ptszMsgBody);
199226
BaseLib_OperatorMemory_FreeCStyle((XPPMEM)&ptszMsgBody);
200227
}
228+
void MQ_ModifyMsg()
229+
{
230+
int nLen = 0;
231+
TCHAR tszMsgBuffer[2048];
232+
memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer));
233+
234+
Json::Value st_JsonRoot;
235+
Json::Value st_JsonMQProtocol;
236+
Json::Value st_JsonPayload;
237+
st_JsonRoot["unOperatorType"] = ENUM_XENGINE_COMMUNICATION_PROTOCOL_TYPE_XMQ;
238+
st_JsonRoot["unOperatorCode"] = XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_MQ_REQMSGMODIFY;
239+
st_JsonRoot["byVersion"] = ENUM_XENGINE_PROTOCOLHDR_PAYLOAD_TYPE_JSON;
240+
st_JsonRoot["xhToken"] = xhToken;
241+
242+
st_JsonMQProtocol["tszMQKey"] = lpszKey;
243+
st_JsonMQProtocol["nSerial"] = 1; //序列号,0服务会自动处理
244+
st_JsonMQProtocol["nKeepTime"] = -1;
245+
st_JsonMQProtocol["nGetTimer"] = 0;
246+
247+
st_JsonPayload["nPayType"] = 0;
248+
st_JsonPayload["nPayLen"] = 6;
249+
st_JsonPayload["tszPayData"] = "modify";
250+
251+
st_JsonRoot["st_MQProtocol"] = st_JsonMQProtocol;
252+
st_JsonRoot["st_Payload"] = st_JsonPayload;
253+
254+
st_JsonRoot["st_MQProtocol"] = st_JsonMQProtocol;
255+
256+
nLen = st_JsonRoot.toStyledString().length();
257+
memcpy(tszMsgBuffer, st_JsonRoot.toStyledString().c_str(), nLen);
258+
259+
TCHAR* ptszMsgBody = NULL;
260+
if (!APIHelp_HttpRequest_Custom(_T("POST"), lpszPostUrl, tszMsgBuffer, NULL, &ptszMsgBody))
261+
{
262+
printf("发送投递失败!\n");
263+
return;
264+
}
265+
printf("MQ_ModifyMsg:%s\n", ptszMsgBody);
266+
BaseLib_OperatorMemory_FreeCStyle((XPPMEM)&ptszMsgBody);
267+
}
268+
void MQ_ModifyTopic()
269+
{
270+
int nLen = 0;
271+
TCHAR tszMsgBuffer[2048];
272+
memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer));
273+
274+
Json::Value st_JsonRoot;
275+
Json::Value st_JsonMQProtocol;
276+
Json::Value st_JsonPayload;
277+
st_JsonRoot["unOperatorType"] = ENUM_XENGINE_COMMUNICATION_PROTOCOL_TYPE_XMQ;
278+
st_JsonRoot["unOperatorCode"] = XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_MQ_REQTOPICMODIFY;
279+
st_JsonRoot["byVersion"] = ENUM_XENGINE_PROTOCOLHDR_PAYLOAD_TYPE_JSON;
280+
st_JsonRoot["xhToken"] = xhToken;
281+
282+
st_JsonMQProtocol["tszMQKey"] = lpszKey;
283+
284+
st_JsonPayload["nPayType"] = ENUM_XENGINE_PROTOCOLHDR_PAYLOAD_TYPE_STRING;
285+
st_JsonPayload["nPayLen"] = (Json::Value::UInt)strlen("XEngine_Modify");
286+
st_JsonPayload["tszPayData"] = "XEngine_Modify";
287+
288+
st_JsonRoot["st_MQProtocol"] = st_JsonMQProtocol;
289+
st_JsonRoot["st_Payload"] = st_JsonPayload;
290+
291+
nLen = st_JsonRoot.toStyledString().length();
292+
memcpy(tszMsgBuffer, st_JsonRoot.toStyledString().c_str(), nLen);
293+
294+
TCHAR* ptszMsgBody = NULL;
295+
if (!APIHelp_HttpRequest_Custom(_T("POST"), lpszPostUrl, tszMsgBuffer, NULL, &ptszMsgBody))
296+
{
297+
printf("发送投递失败!\n");
298+
return;
299+
}
300+
printf("MQ_ModifyTopic:%s\n", ptszMsgBody);
301+
BaseLib_OperatorMemory_FreeCStyle((XPPMEM)&ptszMsgBody);
302+
}
303+
void MQ_Delete()
304+
{
305+
int nLen = 0;
306+
TCHAR tszMsgBuffer[2048];
307+
memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer));
308+
309+
Json::Value st_JsonRoot;
310+
Json::Value st_JsonMQProtocol;
311+
Json::Value st_JsonPayload;
312+
st_JsonRoot["unOperatorType"] = ENUM_XENGINE_COMMUNICATION_PROTOCOL_TYPE_XMQ;
313+
st_JsonRoot["unOperatorCode"] = XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_MQ_REQDELETE;
314+
st_JsonRoot["byVersion"] = ENUM_XENGINE_PROTOCOLHDR_PAYLOAD_TYPE_JSON;
315+
st_JsonRoot["xhToken"] = xhToken;
316+
317+
st_JsonMQProtocol["tszMQKey"] = "XEngine_Modify";
318+
st_JsonRoot["st_MQProtocol"] = st_JsonMQProtocol;
319+
320+
nLen = st_JsonRoot.toStyledString().length();
321+
memcpy(tszMsgBuffer, st_JsonRoot.toStyledString().c_str(), nLen);
322+
323+
TCHAR* ptszMsgBody = NULL;
324+
if (!APIHelp_HttpRequest_Custom(_T("POST"), lpszPostUrl, tszMsgBuffer, NULL, &ptszMsgBody))
325+
{
326+
printf("发送投递失败!\n");
327+
return;
328+
}
329+
printf("MQ_Delete:%s\n", ptszMsgBody);
330+
BaseLib_OperatorMemory_FreeCStyle((XPPMEM)&ptszMsgBody);
331+
}
201332

202333
int main()
203334
{
@@ -207,10 +338,14 @@ int main()
207338
#endif
208339

209340
MQ_Authorize();
341+
MQ_UNRead();
210342
MQ_Create();
211343
MQ_Post("123hello");
212344
MQ_GetNumber();
213345
MQ_Get();
346+
MQ_ModifyMsg();
347+
MQ_ModifyTopic();
348+
MQ_Delete();
214349

215350
#ifdef _WINDOWS
216351
WSACleanup();

XEngine_Docment/Docment_en.docx

4.51 KB
Binary file not shown.

XEngine_Docment/Docment_zh.docx

4.68 KB
Binary file not shown.

XEngine_Release/XEngine_Config/XEngine_Config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"tszPassLogout":""
3838
},
3939
"XVer":[
40+
"3.5.0.1001 Build20230106",
4041
"3.4.0.1001 Build20221110",
4142
"3.3.0.1001 Build20220805",
4243
"3.2.0.1001 Build20220715",

XEngine_SQLFile/XEngine_MQData.sql

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
44
Source Server : Test
55
Source Server Type : MySQL
6-
Source Server Version : 80031 (8.0.31-0ubuntu0.20.04.1)
6+
Source Server Version : 80031 (8.0.31-0ubuntu0.20.04.2)
77
Source Host : 192.168.1.12:3306
88
Source Schema : XEngine_MQData
99
1010
Target Server Type : MySQL
11-
Target Server Version : 80031 (8.0.31-0ubuntu0.20.04.1)
11+
Target Server Version : 80031 (8.0.31-0ubuntu0.20.04.2)
1212
File Encoding : 65001
1313
14-
Date: 04/11/2022 10:47:16
14+
Date: 04/01/2023 16:13:42
1515
*/
1616

1717
SET NAMES utf8mb4;
@@ -33,16 +33,6 @@ CREATE TABLE `XEngine_CommKey` (
3333
`nDataType` tinyint NULL DEFAULT NULL COMMENT '数据类型',
3434
`tszQueueCreateTime` datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '插入时间',
3535
PRIMARY KEY (`ID`) USING BTREE
36-
) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = DYNAMIC;
37-
38-
-- ----------------------------
39-
-- Table structure for XEngine_TimeRelease
40-
-- ----------------------------
41-
DROP TABLE IF EXISTS `XEngine_TimeRelease`;
42-
CREATE TABLE `XEngine_TimeRelease` (
43-
`tszQueueName` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '队列名称',
44-
`nIDMsg` bigint NOT NULL COMMENT '队列唯一ID',
45-
`nIDTime` bigint NOT NULL COMMENT '发布时间'
46-
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
36+
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = DYNAMIC;
4737

4838
SET FOREIGN_KEY_CHECKS = 1;

XEngine_SQLFile/XEngine_MQUser.sql

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
44
Source Server : Test
55
Source Server Type : MySQL
6-
Source Server Version : 80028
6+
Source Server Version : 80031 (8.0.31-0ubuntu0.20.04.2)
77
Source Host : 192.168.1.12:3306
88
Source Schema : XEngine_MQUser
99
1010
Target Server Type : MySQL
11-
Target Server Version : 80028
11+
Target Server Version : 80031 (8.0.31-0ubuntu0.20.04.2)
1212
File Encoding : 65001
1313
14-
Date: 31/03/2022 10:22:53
14+
Date: 03/01/2023 16:39:05
1515
*/
1616

1717
SET NAMES utf8mb4;
@@ -23,30 +23,40 @@ SET FOREIGN_KEY_CHECKS = 0;
2323
DROP TABLE IF EXISTS `UserInfo`;
2424
CREATE TABLE `UserInfo` (
2525
`ID` int NOT NULL AUTO_INCREMENT,
26-
`tszUserName` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户名',
27-
`tszUserPass` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '密码',
28-
`tszEMailAddr` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '电子邮件',
26+
`tszUserName` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '用户名',
27+
`tszUserPass` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '密码',
28+
`tszEMailAddr` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '电子邮件',
2929
`nPhoneNumber` bigint NULL DEFAULT NULL COMMENT '电话号码',
3030
`nIDNumber` bigint NULL DEFAULT NULL COMMENT '身份证',
3131
`nUserState` tinyint NOT NULL COMMENT '用户状态1在线,0离线',
3232
`nUserLevel` int NOT NULL COMMENT '用户等级,数字越小越高',
3333
`tszLoginTime` datetime NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '登录时间',
3434
`tszCreateTime` datetime NOT NULL COMMENT '注册时间',
3535
PRIMARY KEY (`ID`) USING BTREE
36-
) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;
36+
) ENGINE = InnoDB AUTO_INCREMENT = 11 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = DYNAMIC;
3737

3838
-- ----------------------------
3939
-- Table structure for UserKey
4040
-- ----------------------------
4141
DROP TABLE IF EXISTS `UserKey`;
4242
CREATE TABLE `UserKey` (
4343
`ID` int NOT NULL AUTO_INCREMENT,
44-
`tszKeyUser` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户名',
45-
`tszKeyName` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户绑定的KEY名称',
44+
`tszKeyUser` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '用户名',
45+
`tszKeyName` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '用户绑定的KEY名称',
4646
`nKeySerial` bigint NOT NULL COMMENT '用户绑定KEY的序列号',
4747
`tszUPTime` datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
4848
`tszCreateTime` datetime NOT NULL COMMENT '创建的时间',
4949
PRIMARY KEY (`ID`) USING BTREE
50-
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
50+
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = DYNAMIC;
51+
52+
-- ----------------------------
53+
-- Table structure for UserTime
54+
-- ----------------------------
55+
DROP TABLE IF EXISTS `UserTime`;
56+
CREATE TABLE `UserTime` (
57+
`tszQueueName` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '队列名称',
58+
`nIDMsg` bigint NOT NULL COMMENT '队列唯一ID',
59+
`nIDTime` bigint NOT NULL COMMENT '发布时间'
60+
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
5161

5262
SET FOREIGN_KEY_CHECKS = 1;

0 commit comments

Comments
 (0)