2025-05-09 16:53:07 +08:00
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
2025-01-16 16:17:01 +08:00
|
|
|
#include "../json/mms_json_inter.h"
|
2025-05-09 16:53:07 +08:00
|
|
|
#include "../rocketmq/CProducer.h"
|
|
|
|
|
#include "../rocketmq/CMessage.h"
|
|
|
|
|
#include "../rocketmq/CSendResult.h"
|
|
|
|
|
|
|
|
|
|
#include "../rocketmq/CPushConsumer.h"
|
|
|
|
|
|
|
|
|
|
#include <vector>
|
2025-05-12 16:43:42 +08:00
|
|
|
#include <iostream>
|
2025-05-09 16:53:07 +08:00
|
|
|
|
2025-01-16 16:17:01 +08:00
|
|
|
/*添加测试函数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);
|
2025-05-09 16:53:07 +08:00
|
|
|
void rocketmq_StartSendMessage(CProducer* producer,const char* strbody,const char* topic);
|
|
|
|
|
extern "C" {
|
|
|
|
|
void rocketmq_test_rt();
|
|
|
|
|
void rocketmq_test_ud();
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
//void rocketmq_test_300(int mpnum,int front_index);//20241202lnk
|
|
|
|
|
extern void my_rocketmq_send(Ckafka_data_t& data);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////生产者
|
|
|
|
|
void InitializeProducer();
|
|
|
|
|
void ShutdownAndDestroyProducer();
|
|
|
|
|
//////////////////////////////////////////////////////消费者
|
|
|
|
|
void InitializeConsumer(const std::string& consumerName, const std::string& nameServer, const char* topic, const char* tag, const std::string& key);
|
|
|
|
|
void ShutdownAndDestroyConsumer();
|
|
|
|
|
|
|
|
|
|
struct Subscription {
|
|
|
|
|
std::string topic;
|
|
|
|
|
std::string tag;
|
|
|
|
|
MessageCallBack callback;
|
|
|
|
|
|
|
|
|
|
Subscription(const std::string& t, const std::string& tg, MessageCallBack cb)
|
2025-05-12 16:43:42 +08:00
|
|
|
: topic(t), tag(tg), callback(cb) {std::cout << "Subscription topic: " << topic << std::endl;}
|
2025-05-09 16:53:07 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void rocketmq_consumer_receive(
|
|
|
|
|
const std::string& consumerName,
|
|
|
|
|
const std::string& nameServer,
|
|
|
|
|
//const std::string& topic,
|
|
|
|
|
//const std::string& tag,
|
|
|
|
|
//MessageCallBack callback);
|
|
|
|
|
const std::vector<Subscription>& subscriptions);
|
2025-01-16 16:17:01 +08:00
|
|
|
|
2025-05-09 16:53:07 +08:00
|
|
|
//////////////////////////////////////////////////////
|
|
|
|
|
#endif
|
|
|
|
|
//////////////////////////////////////////////////////
|