From a8d1fba23e6cfd4ff0ee60445120a337d283a05f Mon Sep 17 00:00:00 2001 From: lnk Date: Fri, 24 Jul 2026 10:45:02 +0800 Subject: [PATCH] =?UTF-8?q?redis=E4=BD=BF=E7=94=A8uuid=E4=BD=9C=E4=B8=BAke?= =?UTF-8?q?y?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cfg_parse/SimpleProducer.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/cfg_parse/SimpleProducer.cpp b/cfg_parse/SimpleProducer.cpp index 5daadfc..992b984 100644 --- a/cfg_parse/SimpleProducer.cpp +++ b/cfg_parse/SimpleProducer.cpp @@ -46,6 +46,7 @@ //添加redis stream相关头文件 #include "../redisstream/RedisStreamMQ.h" #include +#include using namespace std; @@ -928,6 +929,15 @@ void ShutdownAndDestroyProducer() RocketMQ_ShutdownAndDestroyProducer(); } + +static std::string generate_uuid_key() +{ + QString uuid = QUuid::createUuid().toString(); + uuid.remove('{'); + uuid.remove('}'); + return uuid.toStdString(); +} + void rocketmq_producer_send(const std::string& body, const std::string& topic, const std::string& tags, @@ -935,11 +945,13 @@ void rocketmq_producer_send(const std::string& body, { if (G_MQ_BACKEND == MQ_BACKEND_REDIS_STREAM) { + const std::string uuid = generate_uuid_key(); + RedisStream_producer_send( body, topic, tags, - keys + uuid ); return; }