Skip to content

Commit 292be9c

Browse files
authored
Merge pull request #18 from libxengine/develop
V3.10.0.1001 Merge
2 parents 408b7a7 + 08c892f commit 292be9c

File tree

29 files changed

+374
-305
lines changed

29 files changed

+374
-305
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.10.0.1001
2+
3+
增加:消息属性增加无限制消息获取
4+
增加:http的获取主题消息支持队列统计了
5+
更新:匹配XEngine V8.25版本API
6+
修改:退出协议不在需要验证用户和密码,因为只对自己做登出
7+
修改:用户删除需要身份ID了
8+
修改:消息队列支持默认主题名设置了
9+
修改:获取指定消息时会处理消息识别的一些问题
10+
修改:未读消息协议修改为统计剩余消息了
11+
修改:获取在线列表会验证url参数了
12+
修正:用户登出的http hook没有用户信息的问题
13+
修正:获取消息对于指定消息没有正确处理的问题
14+
删除:数据库模块的DBModule_MQData_List函数
15+
16+
added:message attr add proactive message get.
17+
added:get topic of http restful support get message count
18+
update:match xengine v8.25
19+
modify:does not ver user pass and user name when user logout.just ver self
20+
modify:delete user need id number
21+
modify:support default topic name set for mq protocol
22+
modify:some issues with message identification will be handled when obtaining the specified message
23+
modify:unread message protocol is modify to left count
24+
modify:get online user list ver url parament now
25+
fixed:user logout httppass is not user info
26+
fixed:getting messages will process messages that are not sent to self
27+
delete:DBModule_MQData_List function for dbmoudle
28+
======================================================================================
129
XEngine_MQService V3.9.0.1001
230

331
增加:消息属性的通知所有和通知自身的支持

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ make FLAGS=CleanAll 清理编译
8383
如果是升级安装,下载新版本后修改配置文件就可以直接运行了
8484
数据库需要打开数据库匹配字段和表是否一致
8585

86+
## 视频教程
87+
你也可以观看视频教程来了解我们的代码框架情况:https://www.bilibili.com/video/BV1uH4y1a7QV
88+
8689
#### 使用说明
8790

8891
1. 切换到MASTER分支

XEngine_Apps/MQCore_HTTPApp/MQCore_HTTPApp.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <json/json.h>
55
#pragma comment(lib,"Ws2_32")
66
#pragma comment(lib,"x86/XEngine_BaseLib/XEngine_BaseLib")
7-
#pragma comment(lib,"x86/XEngine_NetHelp/NetHelp_APIClient")
7+
#pragma comment(lib,"x86/XEngine_Client/XClient_APIHelp")
88
#pragma comment(lib,"../../XEngine_Source/Debug/jsoncpp")
99
#endif
1010
#include <stdio.h>
@@ -16,11 +16,12 @@
1616
#include <XEngine_Include/XEngine_ProtocolHdr.h>
1717
#include <XEngine_Include/XEngine_BaseLib/BaseLib_Define.h>
1818
#include <XEngine_Include/XEngine_BaseLib/BaseLib_Error.h>
19-
#include <XEngine_Include/XEngine_NetHelp/APIClient_Define.h>
20-
#include <XEngine_Include/XEngine_NetHelp/APIClient_Error.h>
19+
#include <XEngine_Include/XEngine_Client/APIClient_Define.h>
20+
#include <XEngine_Include/XEngine_Client/APIClient_Error.h>
2121
#include "../../XEngine_Source/XQueue_ProtocolHdr.h"
2222

23-
//g++ -std=c++17 -Wall -g MQCore_HTTPApp.cpp -o MQCore_HTTPApp.exe -I ../../XEngine_Source/XEngine_ThirdPart/jsoncpp -L /usr/local/lib/XEngine_Release/XEngine_BaseLib -L /usr/local/lib/XEngine_Release/XEngine_NetHelp -L ../../XEngine_Source/XEngine_ThirdPart/jsoncpp -lXEngine_BaseLib -lNetHelp_APIClient -ljsoncpp
23+
//g++ -std=c++17 -Wall -g MQCore_HTTPApp.cpp -o MQCore_HTTPApp.exe -I ../../XEngine_Source/XEngine_ThirdPart/jsoncpp -L ../../XEngine_Source/XEngine_ThirdPart/jsoncpp -lXEngine_BaseLib -lXClient_APIHelp -ljsoncpp
24+
2425
void MQ_GetUserList()
2526
{
2627
LPCXSTR lpszPostUrl = _X("http://127.0.0.1:5202/api?function=get&method=user");

XEngine_Apps/MQCore_TCPApp/MQCore_TCPApp.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ using namespace std;
1818
#include <XEngine_Include/XEngine_Client/XClient_Define.h>
1919
#include <XEngine_Include/XEngine_Client/XClient_Error.h>
2020
#include "../../XEngine_Source/XQueue_ProtocolHdr.h"
21-
//g++ -std=c++17 -Wall -g MQCore_TCPApp.cpp -o MQCore_TCPApp.exe -I ../../XEngine_Source/XEngine_ThirdPart/jsoncpp -L /usr/local/lib/XEngine_Release/XEngine_BaseLib -L /usr/local/lib/XEngine_Release/XEngine_Client -L ../../XEngine_Source/XEngine_ThirdPart/jsoncpp -lXEngine_BaseLib -lXClient_Socket
21+
22+
//g++ -std=c++17 -Wall -g MQCore_TCPApp.cpp -o MQCore_TCPApp.exe -I ../../XEngine_Source/XEngine_ThirdPart/jsoncpp -L ../../XEngine_Source/XEngine_ThirdPart/jsoncpp -lXEngine_BaseLib -lXClient_Socket
2223

2324
XSOCKET m_Socket;
2425
__int64x nLastNumber = 0;

XEngine_Apps/VSCopy-x86.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ copy /y "%XEngine_Lib32%\XEngine_BaseLib\XEngine_Algorithm.dll" "./"
33
copy /y "%XEngine_Lib32%\XEngine_Core\XEngine_OPenSsl.dll" "./"
44
copy /y "%XEngine_Lib32%\XEngine_Core\XEngine_ManagePool.dll" "./"
55
copy /y "%XEngine_Lib32%\XEngine_RfcComponents\RfcComponents_WSProtocol.dll" "./"
6-
copy /y "%XEngine_Lib32%\XEngine_NetHelp\NetHelp_APIClient.dll" "./"
6+
copy /y "%XEngine_Lib32%\XEngine_Client\XClient_APIHelp.dll" "./"
77
copy /y "%XEngine_Lib32%\XEngine_Client\XClient_Socket.dll" "./"

XEngine_Docment/Docment_en.docx

-871 Bytes
Binary file not shown.

XEngine_Docment/Docment_zh.docx

-956 Bytes
Binary file not shown.

XEngine_Release/XEngine_Config/XEngine_Config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@
3535
"tszPassLogout":""
3636
},
3737
"XVer":[
38-
"3.9.0.1001 Build20241227",
38+
"3.10.0.1001 Build20240305",
39+
"3.9.0.1001 Build20231227",
3940
"3.8.0.1001 Build20230816",
4041
"3.7.0.1001 Build20230426",
4142
"3.6.0.1001 Build20230222",

XEngine_Source/MQCore_DBModule/DBModule_Define.h

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -129,35 +129,6 @@ extern "C" bool DBModule_MQData_Query(XENGINE_DBMESSAGEQUEUE* pSt_DBInfo);
129129
*********************************************************************/
130130
extern "C" bool DBModule_MQData_Modify(XENGINE_DBMESSAGEQUEUE* pSt_DBInfo);
131131
/********************************************************************
132-
函数名称:DBModule_MQData_List
133-
函数功能:枚举指定主题序列号后的数据
134-
参数.一:lpszQueueName
135-
In/Out:In
136-
类型:常量字符指针
137-
可空:N
138-
意思:输入要处理的主题
139-
参数.二:nSerial
140-
In/Out:In
141-
类型:整数型
142-
可空:N
143-
意思:输入主题序列号
144-
参数.三:pppSt_DBMessage
145-
In/Out:Out
146-
类型:三级指针
147-
可空:N
148-
意思:输出数据队列信息
149-
参数.四:pInt_ListCount
150-
In/Out:Out
151-
类型:整数型
152-
可空:N
153-
意思:输出数据队列大小
154-
返回值
155-
类型:逻辑型
156-
意思:是否成功
157-
备注:
158-
*********************************************************************/
159-
extern "C" bool DBModule_MQData_List(LPCXSTR lpszQueueName, __int64x nSerial, XENGINE_DBMESSAGEQUEUE*** pppSt_DBMessage, int* pInt_ListCount);
160-
/********************************************************************
161132
函数名称:DBModule_MQData_GetSerial
162133
函数功能:获取序列号
163134
参数.一:lpszName
@@ -252,6 +223,30 @@ extern "C" bool DBModule_MQData_ModifyTable(LPCXSTR lpszSrcTable, LPCXSTR lpszDs
252223
备注:
253224
*********************************************************************/
254225
extern "C" bool DBModule_MQData_ShowTable(XCHAR*** pppszTableName, int* pInt_ListCount);
226+
/********************************************************************
227+
函数名称:DBModule_MQData_GetLeftCount
228+
函数功能:获取剩余个数
229+
参数.一:lpszTableName
230+
In/Out:In
231+
类型:常量字符指针
232+
可空:N
233+
意思:输入表名称
234+
参数.二:nSerial
235+
In/Out:In
236+
类型:整数型
237+
可空:N
238+
意思:输入开始的序列号
239+
参数.三:pInt_Count
240+
In/Out:Out
241+
类型:整数型指针
242+
可空:N
243+
意思:输出统计信息
244+
返回值
245+
类型:逻辑型
246+
意思:是否成功
247+
备注:
248+
*********************************************************************/
249+
extern "C" bool DBModule_MQData_GetLeftCount(LPCXSTR lpszTableName, int nSerial, int* pInt_Count);
255250
/*************************************************************************
256251
消息用户导出函数
257252
**************************************************************************/

XEngine_Source/MQCore_DBModule/DBModule_MQData/DBModule_MQData.cpp

Lines changed: 63 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -273,122 +273,6 @@ bool CDBModule_MQData::DBModule_MQData_Modify(XENGINE_DBMESSAGEQUEUE* pSt_DBInfo
273273
return true;
274274
}
275275
/********************************************************************
276-
函数名称:DBModule_MQData_List
277-
函数功能:枚举指定主题序列号后的数据
278-
参数.一:lpszQueueName
279-
In/Out:In
280-
类型:常量字符指针
281-
可空:N
282-
意思:输入要处理的主题
283-
参数.二:nSerial
284-
In/Out:In
285-
类型:整数型
286-
可空:N
287-
意思:输入主题序列号
288-
参数.三:pppSt_DBMessage
289-
In/Out:Out
290-
类型:三级指针
291-
可空:N
292-
意思:输出数据队列信息
293-
参数.四:pInt_ListCount
294-
In/Out:Out
295-
类型:整数型
296-
可空:N
297-
意思:输出数据队列大小
298-
返回值
299-
类型:逻辑型
300-
意思:是否成功
301-
备注:
302-
*********************************************************************/
303-
bool CDBModule_MQData::DBModule_MQData_List(LPCXSTR lpszQueueName, __int64x nSerial, XENGINE_DBMESSAGEQUEUE*** pppSt_DBMessage, int* pInt_ListCount)
304-
{
305-
DBModule_IsErrorOccur = false;
306-
307-
if (NULL == lpszQueueName)
308-
{
309-
DBModule_IsErrorOccur = true;
310-
DBModule_dwErrorCode = ERROR_XENGINE_MQCORE_DATABASE_PARAMENT;
311-
return false;
312-
}
313-
//查询
314-
XNETHANDLE xhTable = 0;
315-
__int64u nllLine = 0;
316-
__int64u nllRow = 0;
317-
318-
XCHAR tszSQLStatement[1024];
319-
memset(tszSQLStatement, '\0', sizeof(tszSQLStatement));
320-
//名称为,消息名为必填
321-
_xstprintf(tszSQLStatement, _X("SELECT * FROM `%s` WHERE nQueueSerial >= %lld"), lpszQueueName, nSerial);
322-
if (!DataBase_MySQL_ExecuteQuery(xhDBSQL, &xhTable, tszSQLStatement, &nllLine, &nllRow))
323-
{
324-
DBModule_IsErrorOccur = true;
325-
DBModule_dwErrorCode = DataBase_GetLastError();
326-
return false;
327-
}
328-
if (nllLine <= 0)
329-
{
330-
DBModule_IsErrorOccur = true;
331-
DBModule_dwErrorCode = ERROR_XENGINE_MQCORE_DATABASE_EMPTY;
332-
return false;
333-
}
334-
*pInt_ListCount = (int)nllLine;
335-
BaseLib_OperatorMemory_Malloc((XPPPMEM)pppSt_DBMessage, (int)nllLine, sizeof(XENGINE_DBMESSAGEQUEUE));
336-
for (__int64u i = 0; i < nllLine; i++)
337-
{
338-
XCHAR** pptszResult = DataBase_MySQL_GetResult(xhDBSQL, xhTable);
339-
XLONG* pInt_Length = DataBase_MySQL_GetLength(xhDBSQL, xhTable);
340-
341-
int nPos = 1;
342-
if (NULL != pptszResult[nPos])
343-
{
344-
_tcsxcpy((*pppSt_DBMessage)[i]->tszUserName, pptszResult[nPos]);
345-
}
346-
nPos++;
347-
if (NULL != pptszResult[nPos])
348-
{
349-
_tcsxcpy((*pppSt_DBMessage)[i]->tszQueueName, pptszResult[nPos]);
350-
}
351-
nPos++;
352-
if (NULL != pptszResult[nPos])
353-
{
354-
(*pppSt_DBMessage)[i]->nQueueSerial = _ttxoll(pptszResult[nPos]);
355-
}
356-
nPos++;
357-
if (NULL != pptszResult[nPos])
358-
{
359-
_tcsxcpy((*pppSt_DBMessage)[i]->tszQueueLeftTime, pptszResult[nPos]);
360-
}
361-
nPos++;
362-
if (NULL != pptszResult[nPos])
363-
{
364-
_tcsxcpy((*pppSt_DBMessage)[i]->tszQueuePublishTime, pptszResult[nPos]);
365-
}
366-
nPos++;
367-
if (NULL != pptszResult[nPos])
368-
{
369-
(*pppSt_DBMessage)[i]->nMsgLen = pInt_Length[nPos];
370-
memcpy((*pppSt_DBMessage)[i]->tszMsgBuffer, pptszResult[nPos], (*pppSt_DBMessage)[i]->nMsgLen);
371-
}
372-
nPos++;
373-
if (NULL != pptszResult[nPos])
374-
{
375-
(*pppSt_DBMessage)[i]->byMsgType = _ttxoi(pptszResult[nPos]);
376-
}
377-
nPos++;
378-
if (NULL != pptszResult[nPos])
379-
{
380-
(*pppSt_DBMessage)[i]->nMsgAttr = _ttxoi(pptszResult[nPos]);
381-
}
382-
nPos++;
383-
if (NULL != pptszResult[nPos])
384-
{
385-
_tcsxcpy((*pppSt_DBMessage)[i]->tszQueueCreateTime, pptszResult[nPos]);
386-
}
387-
}
388-
DataBase_MySQL_FreeResult(xhDBSQL, xhTable);
389-
return true;
390-
}
391-
/********************************************************************
392276
函数名称:DBModule_MQData_GetSerial
393277
函数功能:获取序列号
394278
参数.一:lpszName
@@ -800,4 +684,67 @@ bool CDBModule_MQData::DBModule_MQData_ShowTable(XCHAR*** pppszTableName, int* p
800684
}
801685
DataBase_MySQL_FreeResult(xhDBSQL, xhTable);
802686
return true;
687+
}
688+
/********************************************************************
689+
函数名称:DBModule_MQData_GetLeftCount
690+
函数功能:获取剩余个数
691+
参数.一:lpszTableName
692+
In/Out:In
693+
类型:常量字符指针
694+
可空:N
695+
意思:输入表名称
696+
参数.二:nSerial
697+
In/Out:In
698+
类型:整数型
699+
可空:N
700+
意思:输入开始的序列号
701+
参数.三:pInt_Count
702+
In/Out:Out
703+
类型:整数型指针
704+
可空:N
705+
意思:输出统计信息
706+
返回值
707+
类型:逻辑型
708+
意思:是否成功
709+
备注:
710+
*********************************************************************/
711+
bool CDBModule_MQData::DBModule_MQData_GetLeftCount(LPCXSTR lpszTableName, int nSerial, int* pInt_Count)
712+
{
713+
DBModule_IsErrorOccur = false;
714+
715+
if (NULL == pInt_Count)
716+
{
717+
DBModule_IsErrorOccur = true;
718+
DBModule_dwErrorCode = ERROR_XENGINE_MQCORE_DATABASE_PARAMENT;
719+
return false;
720+
}
721+
//查询
722+
XNETHANDLE xhTable = 0;
723+
__int64u nllLine = 0;
724+
__int64u nllRow = 0;
725+
726+
XCHAR tszSQLStatement[1024];
727+
memset(tszSQLStatement, '\0', sizeof(tszSQLStatement));
728+
729+
_xstprintf(tszSQLStatement, _X("SELECT COUNT(*) FROM %s WHERE nQueueSerial > %d"), lpszTableName, nSerial);
730+
if (!DataBase_MySQL_ExecuteQuery(xhDBSQL, &xhTable, tszSQLStatement, &nllLine, &nllRow))
731+
{
732+
DBModule_IsErrorOccur = true;
733+
DBModule_dwErrorCode = DataBase_GetLastError();
734+
return false;
735+
}
736+
if (nllLine <= 0)
737+
{
738+
DBModule_IsErrorOccur = true;
739+
DBModule_dwErrorCode = ERROR_XENGINE_MQCORE_DATABASE_EMPTY;
740+
return false;
741+
}
742+
XCHAR** pptszResult = DataBase_MySQL_GetResult(xhDBSQL, xhTable);
743+
744+
if (NULL != pptszResult[0])
745+
{
746+
*pInt_Count = _ttxoi(pptszResult[0]);
747+
}
748+
DataBase_MySQL_FreeResult(xhDBSQL, xhTable);
749+
return true;
803750
}

0 commit comments

Comments
 (0)