redis使用uuid作为key
This commit is contained in:
@@ -46,6 +46,7 @@
|
||||
//添加redis stream相关头文件
|
||||
#include "../redisstream/RedisStreamMQ.h"
|
||||
#include <QSettings>
|
||||
#include <QUuid>
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user