2026-06-24 16:37:32 +08:00
|
|
|
|
#ifndef REDIS_STREAM_MQ_H
|
|
|
|
|
|
#define REDIS_STREAM_MQ_H
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
* lnk20260622 新增:Redis Streams 后端声明(运行时切换版)。
|
|
|
|
|
|
*
|
|
|
|
|
|
* 注意:
|
|
|
|
|
|
* 1. 本文件不定义 InitializeProducer / rocketmq_producer_send 等统一入口。
|
|
|
|
|
|
* 2. 只定义 RedisStream_xxx 后端函数,统一入口放在 SimpleProducer.cpp 中按配置转发。
|
|
|
|
|
|
* 3. 这样 RocketMQ 原源码和 RedisStream 源码可以同时编译进程序。
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
//#include "mq_compat.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
2026-06-30 14:19:27 +08:00
|
|
|
|
// lnk20260626 修改:RedisStreamMQ.h 只需要知道 MQMessageExt 是一个类型即可
|
|
|
|
|
|
// 这里用前向声明,避免 RedisStreamMQ.h 直接依赖 RocketMQ 头文件
|
|
|
|
|
|
namespace rocketmq {
|
|
|
|
|
|
class MQMessageExt;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-24 16:37:32 +08:00
|
|
|
|
struct Subscription;
|
|
|
|
|
|
|
|
|
|
|
|
void RedisStream_InitializeProducer();
|
|
|
|
|
|
void RedisStream_ShutdownAndDestroyProducer();
|
|
|
|
|
|
|
|
|
|
|
|
void RedisStream_producer_send(const std::string& body,
|
|
|
|
|
|
const std::string& topic,
|
|
|
|
|
|
const std::string& tags,
|
|
|
|
|
|
const std::string& keys);
|
|
|
|
|
|
|
|
|
|
|
|
void RedisStream_InitializeConsumer(const std::string& consumerName,
|
|
|
|
|
|
const std::string& nameServer,
|
|
|
|
|
|
const std::vector<Subscription>& subscriptions);
|
|
|
|
|
|
|
|
|
|
|
|
void RedisStream_ShutdownAndDestroyConsumer();
|
|
|
|
|
|
|
|
|
|
|
|
void RedisStream_consumer_receive(const std::string& consumerName,
|
|
|
|
|
|
const std::string& nameServer,
|
|
|
|
|
|
const std::vector<Subscription>& subscriptions);
|
|
|
|
|
|
|
|
|
|
|
|
bool RedisStream_should_process_after_start(const rocketmq::MQMessageExt& msg);
|
|
|
|
|
|
|
|
|
|
|
|
#endif // REDIS_STREAM_MQ_H
|