Skip to content

Commit 63e9b41

Browse files
authored
Merge pull request #51 from libxengine/develop
V3.19 Version Release
2 parents a45bde1 + 6c1d4ae commit 63e9b41

34 files changed

Lines changed: 1156 additions & 1140 deletions

.github/workflows/Rocky_build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,6 @@ jobs:
9797
- name: Upload folder as artifact with CentOS
9898
uses: actions/upload-artifact@v4
9999
with:
100-
name: XEngine_MQServiceApp-CentOS_${{ matrix.version }}_${{ matrix.artifact }}
100+
name: XEngine_MQServiceApp-RockyLinux_${{ matrix.version }}_${{ matrix.artifact }}
101101
path: XEngine_Release/
102102
retention-days: 1

CHANGELOG

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,39 @@
1+
XEngine_MQService V3.19.0.1001
2+
3+
增加:权限控制开关
4+
增加:数据传输加密支持
5+
更新:依赖库
6+
修改:mqtt协议的订阅和取消订阅不在交给tcp处理并且mqtt协议流程代码修改
7+
修改:当tcp登录的时候会创建http的token了
8+
修改:重构了tcp和http协议,现在大部分消息处理都通过http实现,tcp只处理投递订阅和获取消息
9+
修改:绑定消息协议字符串
10+
修改:协议消息统一
11+
修改:权限控制和处理
12+
修改:tcp登录权限处理
13+
修正:某些时候协议没有响应和解析问题
14+
修正:当post的协议找不到的时候没有响应问题
15+
修正:当没有找到http协议的时候无响应问题
16+
删除:http公用消息打包函数
17+
删除:多余的协议错误定义
18+
19+
added:permission control of build switch
20+
added:data transfer crypt
21+
update:depend library
22+
modify:mqtt protcol bind and unbind does not post tcp handle and mqtt protocol process modify
23+
modify:create token of http when tcp login
24+
modify:Reconstruct the TCP and HTTP protocols,now the data processed by the HTTP protocol is no longer handed over to the TCP for processing
25+
modify:message and topic modify and request message number to http protocol
26+
modify:does not case-sensitive
27+
modify:bind message protocol string
28+
modify:protocol user unified
29+
modify:permission management and process
30+
modify:tcp login permission handle
31+
fixed:some protocol not reply and parse process failure
32+
fixed:no reply when not found post protocol
33+
fixed:http protocol not reply when not found protocol
34+
delete:http comm message packet
35+
delete:more protocol error define
36+
======================================================================================
137
XEngine_MQService V3.18.0.1001
238

339
ci:增加CentOS和Alma以及debian13系统支持

README.en.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ this software support following features
1919
3. message timeout
2020
4. topic Partition
2121
5. message tracking(planning)
22-
6. encrypt Communication(planning)
22+
6. encrypt Communication
2323
7. load balanc(planning)
2424
8. message get time
2525
9. message subcribe
@@ -38,6 +38,7 @@ this software support following features
3838
22. http verification
3939
23. email notify
4040
24. sms notify(plan)
41+
25. permission control
4142

4243
## install
4344

@@ -108,6 +109,8 @@ database you need to open the database matching fields and tables are consistent
108109

109110
## other problems
110111
You can refer to the document under the docment directory. It contains API protocol and service description.
112+
#### Compiler Options
113+
When __XENGINE_MESSAGEQUEUE_BUILD_SWITCH_PERMISSION__ == 1, permission control can be enabled. Only users with administrator privileges can operate critical permissions, and this is mainly intended for HTTP interfaces
111114

112115
## Test Server Address
113116
Address:app.xyry.org Port:TCP 5200,WEBSOCKET 5201,HTTP Management Interface 5202

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ c c++Message Service
2121
3. 消息超时
2222
4. 主题分区
2323
5. 消息回溯
24-
6. 加密通信(planning)
24+
6. 加密通信
2525
7. 负载均衡(planning)
2626
8. 消息次数
2727
9. 消息订阅
@@ -40,6 +40,7 @@ c c++Message Service
4040
22. http验证
4141
23. 电子邮件通知
4242
24. 短信通知(plan)
43+
25. 权限控制
4344

4445
## 安装教程
4546

@@ -118,6 +119,9 @@ make FLAGS=CleanAll 清理编译
118119
## 其他问题
119120
你可以参考docment目录下的文档.里面包含了API协议和服务说明.
120121

122+
#### 编译选项
123+
__XENGINE_MESSAGEQUEUE_BUILD_SWITCH_PERMISSION__ == 1 可以开启权限控制,只有管理员权限才可以操作关键权限,主要用于HTTP接口
124+
121125
## 测试服务器
122126
地址:app.xyry.org 端口:TCP 5200,WEBSOCKET 5201,管理接口HTTP 5202
123127

XEngine_Apps/MQCore_HTTPApp/MQCore_HTTPApp.cpp

Lines changed: 125 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,53 @@
2222
//VS2022 Debug x86 Compile
2323
//g++ -std=c++17 -Wall -g MQCore_HTTPApp.cpp -o MQCore_HTTPApp.exe -lXEngine_BaseLib -lXClient_APIHelp
2424
__int64x xhToken = 0;
25+
26+
//获取未读消息
27+
void MQ_GetUNRead()
28+
{
29+
LPCXSTR lpszPostUrl = _X("http://127.0.0.1:5202/api?function=unreadmsg");
30+
31+
Json::Value st_JsonRoot;
32+
Json::Value st_JsonObject;
33+
34+
st_JsonObject["tszMQUsr"] = "123123aa";
35+
st_JsonObject["tszMQKey"] = "XEngine_MSGKeyName";
36+
st_JsonRoot["xhToken"] = xhToken;
37+
st_JsonRoot["Object"] = st_JsonObject;
38+
39+
int nLen = 0;
40+
XCHAR* ptszMsgBody = NULL;
41+
if (!APIClient_Http_Request(_X("POST"), lpszPostUrl, st_JsonRoot.toStyledString().c_str(), NULL, &ptszMsgBody, &nLen))
42+
{
43+
_xtprintf("发送投递失败!\n");
44+
return;
45+
}
46+
_xtprintf("MQ_GetUNRead:%s\n", ptszMsgBody);
47+
BaseLib_Memory_FreeCStyle((XPPMEM)&ptszMsgBody);
48+
}
49+
void MQ_DelMsg()
50+
{
51+
LPCXSTR lpszPostUrl = _X("http://127.0.0.1:5202/api?function=deletemsg");
52+
53+
Json::Value st_JsonRoot;
54+
Json::Value st_JsonObject;
55+
56+
st_JsonObject["nSerial"] = 1;
57+
st_JsonObject["tszMQKey"] = "XEngine_MSGKeyName";
58+
st_JsonRoot["xhToken"] = xhToken;
59+
st_JsonRoot["Object"] = st_JsonObject;
60+
61+
int nLen = 0;
62+
XCHAR* ptszMsgBody = NULL;
63+
if (!APIClient_Http_Request(_X("POST"), lpszPostUrl, st_JsonRoot.toStyledString().c_str(), NULL, &ptszMsgBody, &nLen))
64+
{
65+
_xtprintf("发送投递失败!\n");
66+
return;
67+
}
68+
_xtprintf("MQ_DelMsg:%s\n", ptszMsgBody);
69+
BaseLib_Memory_FreeCStyle((XPPMEM)&ptszMsgBody);
70+
}
71+
2572
void MQ_UserRegister()
2673
{
2774
LPCXSTR lpszPostUrl = _X("http://127.0.0.1:5202/api?function=register");
@@ -71,7 +118,7 @@ void MQ_UserLogin()
71118
}
72119
void MQ_UserDelete()
73120
{
74-
LPCXSTR lpszPostUrl = _X("http://127.0.0.1:5202/api?function=deluser");
121+
LPCXSTR lpszPostUrl = _X("http://127.0.0.1:5202/api?function=deleteuser");
75122

76123
Json::Value st_JsonRoot;
77124
Json::Value st_JsonUser;
@@ -132,7 +179,32 @@ void MQ_TopicCreate()
132179
Json::Value st_JsonRoot;
133180
Json::Value st_JsonObject;
134181

135-
st_JsonObject["name"] = "topictest";
182+
st_JsonObject["tszMQUsr"] = "123123aa";
183+
st_JsonObject["tszMQKey"] = "topictest";
184+
185+
st_JsonRoot["xhToken"] = xhToken;
186+
st_JsonRoot["Object"] = st_JsonObject;
187+
188+
int nLen = 0;
189+
XCHAR* ptszMsgBody = NULL;
190+
if (!APIClient_Http_Request(_X("POST"), lpszPostUrl, st_JsonRoot.toStyledString().c_str(), NULL, &ptszMsgBody, &nLen))
191+
{
192+
_xtprintf("发送投递失败!\n");
193+
return;
194+
}
195+
_xtprintf("MQ_TopicCreate:%s\n", ptszMsgBody);
196+
BaseLib_Memory_FreeCStyle((XPPMEM)&ptszMsgBody);
197+
}
198+
void MQ_TopicModify()
199+
{
200+
LPCXSTR lpszPostUrl = _X("http://127.0.0.1:5202/api?function=modifytopic");
201+
202+
Json::Value st_JsonRoot;
203+
Json::Value st_JsonObject;
204+
205+
st_JsonObject["tszMQUsr"] = "123123aa";
206+
st_JsonObject["tszSrcTopic"] = "topictest";
207+
st_JsonObject["tszDstTopic"] = "topic2test";
136208

137209
st_JsonRoot["xhToken"] = xhToken;
138210
st_JsonRoot["Object"] = st_JsonObject;
@@ -147,14 +219,16 @@ void MQ_TopicCreate()
147219
_xtprintf("MQ_TopicCreate:%s\n", ptszMsgBody);
148220
BaseLib_Memory_FreeCStyle((XPPMEM)&ptszMsgBody);
149221
}
222+
150223
void MQ_TopicDelete()
151224
{
152225
LPCXSTR lpszPostUrl = _X("http://127.0.0.1:5202/api?function=deletetopic");
153226

154227
Json::Value st_JsonRoot;
155228
Json::Value st_JsonObject;
156229

157-
st_JsonObject["name"] = "topictest";
230+
st_JsonObject["tszMQUsr"] = "123123aa";
231+
st_JsonObject["tszMQKey"] = "topic2test";
158232

159233
st_JsonRoot["xhToken"] = xhToken;
160234
st_JsonRoot["Object"] = st_JsonObject;
@@ -169,6 +243,49 @@ void MQ_TopicDelete()
169243
_xtprintf("MQ_TopicDelete:%s\n", ptszMsgBody);
170244
BaseLib_Memory_FreeCStyle((XPPMEM)&ptszMsgBody);
171245
}
246+
void MQ_GetTopic()
247+
{
248+
LPCXSTR lpszPostUrl = _X("http://127.0.0.1:5202/api?function=gettopic");
249+
250+
Json::Value st_JsonRoot;
251+
Json::Value st_JsonObject;
252+
253+
st_JsonRoot["xhToken"] = xhToken;
254+
st_JsonObject["tszMQKey"] = "topictest";
255+
st_JsonRoot["Object"] = st_JsonObject;
256+
257+
int nLen = 0;
258+
XCHAR* ptszMsgBody = NULL;
259+
if (!APIClient_Http_Request(_X("POST"), lpszPostUrl, st_JsonRoot.toStyledString().c_str(), NULL, &ptszMsgBody, &nLen))
260+
{
261+
_xtprintf("发送投递失败!\n");
262+
return;
263+
}
264+
_xtprintf("MQ_GetTopic:%s\n", ptszMsgBody);
265+
BaseLib_Memory_FreeCStyle((XPPMEM)&ptszMsgBody);
266+
}
267+
void MQ_GetNumber()
268+
{
269+
LPCXSTR lpszPostUrl = _X("http://127.0.0.1:5202/api?function=getnumber");
270+
271+
Json::Value st_JsonRoot;
272+
Json::Value st_JsonObject;
273+
274+
st_JsonObject["nKeepTime"] = 1;
275+
st_JsonObject["tszMQKey"] = "XEngine_CommKey";
276+
st_JsonRoot["xhToken"] = xhToken;
277+
st_JsonRoot["Object"] = st_JsonObject;
278+
279+
int nLen = 0;
280+
XCHAR* ptszMsgBody = NULL;
281+
if (!APIClient_Http_Request(_X("POST"), lpszPostUrl, st_JsonRoot.toStyledString().c_str(), NULL, &ptszMsgBody, &nLen))
282+
{
283+
_xtprintf("发送投递失败!\n");
284+
return;
285+
}
286+
_xtprintf("MQ_GetNumber:%s\n", ptszMsgBody);
287+
BaseLib_Memory_FreeCStyle((XPPMEM)&ptszMsgBody);
288+
}
172289
void MQ_GetTopicList()
173290
{
174291
LPCXSTR lpszPostUrl = _X("http://127.0.0.1:5202/api?function=getlist");
@@ -196,12 +313,17 @@ int main()
196313

197314
MQ_UserRegister();
198315
MQ_UserLogin();
316+
MQ_GetUNRead();
199317
MQ_GetUserList();
200318
MQ_GetOnlineList();
201319
MQ_TopicCreate();
320+
MQ_GetTopic();
321+
MQ_GetNumber();
202322
MQ_GetTopicList();
323+
MQ_TopicModify();
203324
MQ_TopicDelete();
204325
MQ_UserDelete();
326+
205327
#ifdef _MSC_BUILD
206328
WSACleanup();
207329
#endif

0 commit comments

Comments
 (0)