@@ -330,7 +330,7 @@ bool MessageQueue_TCP_Handle(XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, LPCXSTR lpszC
330330 time_t nTimeStart = time (NULL );
331331 time_t nTimeEnd = nTimeStart + st_MQProtocol.nKeepTime ;
332332 BaseLib_OperatorTimeSpan_CalForTime (nTimeStart, nTimeEnd, &st_LibTime);
333- _xstprintf (st_DBQueue.tszQueueLeftTime , _X ( " %04d-%02d-%02d %02d:%02d:%02d " ), st_LibTime. wYear , st_LibTime. wMonth , st_LibTime. wDay , st_LibTime. wHour , st_LibTime. wMinute , st_LibTime. wSecond );
333+ BaseLib_OperatorTime_TimeToStr (st_DBQueue.tszQueueLeftTime , NULL , true , & st_LibTime);
334334 }
335335 // 处理序列号
336336 if (st_DBQueue.nQueueSerial > 0 )
@@ -495,6 +495,51 @@ bool MessageQueue_TCP_Handle(XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, LPCXSTR lpszC
495495 XLOG_PRINT (xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X (" %s消息端:%s,主题:%s,获取消息数据失败,获取指定消息序列:%lld 失败,错误:%lX" ), lpszClientType, lpszClientAddr, st_MQProtocol.tszMQKey , st_MQProtocol.nSerial , DBModule_GetLastError ());
496496 return false ;
497497 }
498+ // 获得此消息属性
499+ XENGINE_PROTOCOL_MSGATTR st_MSGAttr = {};
500+ memcpy (&st_MSGAttr, &st_MessageQueue.nMsgAttr , sizeof (XENGINE_PROTOCOL_MSGATTR));
501+ // 所属用户
502+ if (_tcsxlen (st_MessageQueue.tszUserBelong ) > 0 )
503+ {
504+ if (1 != st_MSGAttr.byAttrActive )
505+ {
506+ pSt_ProtocolHdr->wReserve = 723 ;
507+ ProtocolModule_Packet_Common (nNetType, pSt_ProtocolHdr, &st_MQProtocol, tszSDBuffer, &nSDLen);
508+ XEngine_MQXService_Send (lpszClientAddr, tszSDBuffer, nSDLen, nNetType);
509+ XLOG_PRINT (xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X (" %s消息端:%s,主题:%s,获取消息数据失败,获取指定消息序列:%lld 失败,错误:此消息不属于此用户" ), lpszClientType, lpszClientAddr, st_MQProtocol.tszMQKey , st_MQProtocol.nSerial );
510+ return false ;
511+ }
512+ }
513+ // 过期任务
514+ if (_tcsxlen (st_MessageQueue.tszQueueLeftTime ) > 2 )
515+ {
516+ // 有过期时间,判断是否过期
517+ __int64x nTimeRet = 0 ;
518+ XCHAR tszTimeStr[MAX_PATH] = {};
519+ BaseLib_OperatorTime_TimeToStr (tszTimeStr);
520+ BaseLib_OperatorTimeSpan_GetForStr (st_MessageQueue.tszQueueLeftTime , tszTimeStr, &nTimeRet, 3 );
521+ // 如果超时并且不允许主动获取,返回错误
522+ if ((nTimeRet < 0 ) && (1 != st_MSGAttr.byAttrActive ))
523+ {
524+ pSt_ProtocolHdr->wReserve = 724 ;
525+ ProtocolModule_Packet_Common (nNetType, pSt_ProtocolHdr, &st_MQProtocol, tszSDBuffer, &nSDLen);
526+ XEngine_MQXService_Send (lpszClientAddr, tszSDBuffer, nSDLen, nNetType);
527+ XLOG_PRINT (xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X (" %s消息端:%s,主题:%s,获取消息数据失败,获取指定消息序列:%lld 失败,错误:消息超时" ), lpszClientType, lpszClientAddr, st_MQProtocol.tszMQKey , st_MQProtocol.nSerial );
528+ return false ;
529+ }
530+ }
531+ // 定时发布任务
532+ if (_tcsxlen (st_MessageQueue.tszQueuePublishTime ) > 0 )
533+ {
534+ if (1 != st_MSGAttr.byAttrActive )
535+ {
536+ pSt_ProtocolHdr->wReserve = 725 ;
537+ ProtocolModule_Packet_Common (nNetType, pSt_ProtocolHdr, &st_MQProtocol, tszSDBuffer, &nSDLen);
538+ XEngine_MQXService_Send (lpszClientAddr, tszSDBuffer, nSDLen, nNetType);
539+ XLOG_PRINT (xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X (" %s消息端:%s,主题:%s,获取消息数据失败,获取指定消息序列:%lld 失败,错误:此为定时发布任务" ), lpszClientType, lpszClientAddr, st_MQProtocol.tszMQKey , st_MQProtocol.nSerial );
540+ return false ;
541+ }
542+ }
498543 }
499544 else
500545 {
0 commit comments