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; }