Skip to content

Commit 7a4eade

Browse files
committed
modify:does not allow to create topic when the topic is existed
1 parent d91bc24 commit 7a4eade

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

XEngine_Source/XEngine_MQServiceApp/MQService_TCPTask.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,25 @@ bool MessageQueue_TCP_Handle(XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, LPCXSTR lpszC
681681
else if (XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_MQ_REQTOPICCREATE == pSt_ProtocolHdr->unOperatorCode)
682682
{
683683
pSt_ProtocolHdr->unOperatorCode = XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_MQ_REPTOPICCREATE;
684+
685+
int nListCount = 0;
686+
XCHAR** ppszTableName;
687+
//检查表是否存在
688+
DBModule_MQData_ShowTable(&ppszTableName, &nListCount);
689+
for (int i = 0; i < nListCount; i++)
690+
{
691+
if (0 == _tcsxnicmp(ppszTableName[i], st_MQProtocol.tszMQKey, _tcsxlen(ppszTableName[i])))
692+
{
693+
if (pSt_ProtocolHdr->byIsReply)
694+
{
695+
pSt_ProtocolHdr->wReserve = ERROR_XENGINE_MESSAGE_XMQ_CREATEKEY;
696+
ProtocolModule_Packet_Common(nNetType, pSt_ProtocolHdr, &st_MQProtocol, tszSDBuffer, &nSDLen);
697+
XEngine_MQXService_Send(lpszClientAddr, tszSDBuffer, nSDLen, nNetType);
698+
}
699+
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("%s消息端:%s,创建主题失败,主题名称:%s,主题存在,无法继续"), lpszClientType, lpszClientAddr, st_MQProtocol.tszMQKey);
700+
return false;
701+
}
702+
}
684703
//创建表
685704
if (!DBModule_MQData_CreateTable(st_MQProtocol.tszMQKey))
686705
{

0 commit comments

Comments
 (0)