2025-01-16 16:17:01 +08:00
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
#include "../json/mms_json_inter.h"
|
2026-04-28 11:44:40 +08:00
|
|
|
//#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"
|
|
|
|
|
#include "../rocketmq/SessionCredentials.h"
|
|
|
|
|
#include "../rocketmq/MQMessageExt.h"
|
|
|
|
|
#include "../rocketmq/ConsumeType.h"
|
|
|
|
|
#include "../rocketmq/MQMessageListener.h"
|
2025-01-16 16:17:01 +08:00
|
|
|
|
|
|
|
|
#include <vector>
|
2026-04-28 11:44:40 +08:00
|
|
|
#include <iostream>
|
|
|
|
|
#include <string>
|
2025-01-16 16:17:01 +08:00
|
|
|
|
2026-04-28 11:44:40 +08:00
|
|
|
using namespace rocketmq;
|
2025-01-16 16:17:01 +08:00
|
|
|
|
|
|
|
|
/*添加测试函数lnk10-10*/
|
2026-04-28 11:44:40 +08:00
|
|
|
//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,
|
|
|
|
|
const std::string& topic,
|
|
|
|
|
const std::string& tags,
|
|
|
|
|
const std::string& keys);
|
2025-01-16 16:17:01 +08:00
|
|
|
extern "C" {
|
|
|
|
|
void rocketmq_test_rt();
|
|
|
|
|
void rocketmq_test_ud();
|
|
|
|
|
void rocketmq_test_rc();
|
2025-02-26 16:39:10 +08:00
|
|
|
void rocketmq_test_log();
|
2025-01-16 16:17:01 +08:00
|
|
|
void rocketmq_test_set();
|
2025-02-11 18:23:19 +08:00
|
|
|
void rocketmq_test_only();
|
2025-05-28 16:09:15 +08:00
|
|
|
void rocketmq_test_300(int mpnum,int front_index,int type);
|
2025-01-16 16:17:01 +08:00
|
|
|
}
|
|
|
|
|
extern void my_rocketmq_send(Ckafka_data_t& data);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////生产者
|
|
|
|
|
void InitializeProducer();
|
|
|
|
|
void ShutdownAndDestroyProducer();
|
|
|
|
|
//////////////////////////////////////////////////////消费者
|
2026-04-28 11:44:40 +08:00
|
|
|
typedef ConsumeStatus (*MessageCallBack)(
|
|
|
|
|
const MQMessageExt& msg
|
|
|
|
|
);
|
2025-01-16 16:17:01 +08:00
|
|
|
|
|
|
|
|
struct Subscription {
|
|
|
|
|
std::string topic;
|
|
|
|
|
std::string tag;
|
|
|
|
|
MessageCallBack callback;
|
2026-04-28 11:44:40 +08:00
|
|
|
|
|
|
|
|
Subscription(const std::string& t,
|
|
|
|
|
const std::string& tg,
|
|
|
|
|
MessageCallBack cb)
|
2025-01-16 16:17:01 +08:00
|
|
|
: topic(t), tag(tg), callback(cb) {}
|
|
|
|
|
};
|
2026-04-28 11:44:40 +08:00
|
|
|
//void InitializeConsumer(const std::string& consumerName, const std::string& nameServer, const char* topic, const char* tag, const std::string& key);
|
|
|
|
|
void InitializeConsumer(const std::string& consumerName,
|
|
|
|
|
const std::string& nameServer,
|
|
|
|
|
const std::vector<Subscription>& subscriptions);
|
|
|
|
|
void ShutdownAndDestroyConsumer();
|
2025-01-16 16:17:01 +08:00
|
|
|
|
|
|
|
|
void rocketmq_consumer_receive(
|
|
|
|
|
const std::string& consumerName,
|
|
|
|
|
const std::string& nameServer,
|
|
|
|
|
const std::vector<Subscription>& subscriptions);
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////
|
|
|
|
|
#endif
|
|
|
|
|
//////////////////////////////////////////////////////
|