redis引入未完成
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
#ifndef SIMPLEPRODUCER_H
|
||||
#define SIMPLEPRODUCER_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "../json/mms_json_inter.h"
|
||||
//#include "../rocketmq/CProducer.h"
|
||||
//#include "../rocketmq/CMessage.h"
|
||||
//#include "../rocketmq/CSendResult.h"
|
||||
//#include "../rocketmq/CPushConsumer.h"
|
||||
|
||||
#include "../rocketmq/DefaultMQProducer.h"
|
||||
#include "../rocketmq/MQMessage.h"
|
||||
#include "../rocketmq/SendResult.h"
|
||||
@@ -17,18 +17,44 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
/*
|
||||
* lnk20260622 修改:
|
||||
* 支持 RocketMQ / Redis Streams 双后端。
|
||||
*
|
||||
* 编译时:两套源码都编译进去。
|
||||
* 运行时:通过配置文件 [MQ] Backend=rocketmq 或 redisstream 选择。
|
||||
*
|
||||
* 业务层仍然使用:
|
||||
* rocketmq::MQMessageExt
|
||||
* rocketmq::ConsumeStatus
|
||||
* Subscription
|
||||
* InitializeProducer()
|
||||
* rocketmq_producer_send()
|
||||
* InitializeConsumer()
|
||||
*
|
||||
* 不需要业务层判断当前走 RocketMQ 还是 RedisStream。
|
||||
*/
|
||||
|
||||
/*
|
||||
* 关键:
|
||||
* mq_compat.h 里必须定义兼容的:
|
||||
* namespace rocketmq {
|
||||
* enum ConsumeStatus;
|
||||
* class MQMessageExt;
|
||||
* }
|
||||
*
|
||||
* 如果实际编译 RocketMQ,也可以让 mq_compat.h 内部 include RocketMQ 原头。
|
||||
*/
|
||||
//#include "../mq/mq_compat.h"
|
||||
#include "../rocketmq/SimpleProducer.h"
|
||||
|
||||
using namespace rocketmq;
|
||||
|
||||
/*添加测试函数lnk10-10*/
|
||||
//void producer_send0();
|
||||
//void StartSendMessage(CProducer* producer,const char* strbody);
|
||||
//void producer_send(const char* strbody);
|
||||
//void rocketmq_producer_send(const char* strbody,const char* topic);
|
||||
//void rocketmq_StartSendMessage(CProducer* producer,const char* strbody,const char* topic);
|
||||
void rocketmq_producer_send(const std::string& body,
|
||||
void RocketMQ_rocketmq_producer_send(const std::string& body,
|
||||
const std::string& topic,
|
||||
const std::string& tags,
|
||||
const std::string& keys);
|
||||
|
||||
extern "C" {
|
||||
void rocketmq_test_rt();
|
||||
void rocketmq_test_ud();
|
||||
@@ -36,15 +62,18 @@ void rocketmq_test_rc();
|
||||
void rocketmq_test_log();
|
||||
void rocketmq_test_set();
|
||||
void rocketmq_test_only();
|
||||
void rocketmq_test_300(int mpnum,int front_index,int type);
|
||||
void rocketmq_test_300(int mpnum, int front_index, int type);
|
||||
}
|
||||
|
||||
extern void my_rocketmq_send(Ckafka_data_t& data);
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
// 生产者统一入口
|
||||
void RocketMQ_InitializeProducer();
|
||||
void RocketMQ_ShutdownAndDestroyProducer();
|
||||
|
||||
///////////////////////////////////////////////////////生产者
|
||||
void InitializeProducer();
|
||||
void ShutdownAndDestroyProducer();
|
||||
//////////////////////////////////////////////////////消费者
|
||||
///////////////////////////////////////////////////////
|
||||
// 消费者统一入口
|
||||
typedef ConsumeStatus (*MessageCallBack)(
|
||||
const MQMessageExt& msg
|
||||
);
|
||||
@@ -59,7 +88,24 @@ struct Subscription {
|
||||
MessageCallBack cb)
|
||||
: topic(t), tag(tg), callback(cb) {}
|
||||
};
|
||||
//void InitializeConsumer(const std::string& consumerName, const std::string& nameServer, const char* topic, const char* tag, const std::string& key);
|
||||
|
||||
void RocketMQ_InitializeConsumer(const std::string& consumerName,
|
||||
const std::string& nameServer,
|
||||
const std::vector<Subscription>& subscriptions);
|
||||
|
||||
void RocketMQ_ShutdownAndDestroyConsumer();
|
||||
|
||||
void RocketMQ_rocketmq_consumer_receive(
|
||||
const std::string& consumerName,
|
||||
const std::string& nameServer,
|
||||
const std::vector<Subscription>& subscriptions);
|
||||
|
||||
void rocketmq_producer_send(const std::string& body,
|
||||
const std::string& topic,
|
||||
const std::string& tags,
|
||||
const std::string& keys);
|
||||
void InitializeProducer();
|
||||
void ShutdownAndDestroyProducer();
|
||||
void InitializeConsumer(const std::string& consumerName,
|
||||
const std::string& nameServer,
|
||||
const std::vector<Subscription>& subscriptions);
|
||||
@@ -69,7 +115,8 @@ void rocketmq_consumer_receive(
|
||||
const std::string& consumerName,
|
||||
const std::string& nameServer,
|
||||
const std::vector<Subscription>& subscriptions);
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
#endif
|
||||
//////////////////////////////////////////////////////
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // SIMPLEPRODUCER_H
|
||||
Reference in New Issue
Block a user