xige-16 c076bd4a73 Fix the error that write node cannot receive the message
Signed-off-by: xige-16 <xi.ge@zilliz.com>
2020-09-06 15:56:10 +08:00

43 lines
983 B
C++

#pragma once
#include "pulsar/Consumer.h"
#include "Client.h"
namespace milvus {
namespace message_client {
enum ConsumerType {
INSERT = 0,
DELETE = 1,
SEARCH_RESULT = 2,
TEST = 3,
};
using Consumer = pulsar::Consumer;
using ConsumerConfiguration = pulsar::ConsumerConfiguration;
class MsgConsumer{
public:
MsgConsumer(std::shared_ptr<pulsar::Client> &client, std::string consumer_name,
const pulsar::ConsumerConfiguration conf = ConsumerConfiguration());
Result subscribe(const std::string& topic);
Result subscribe(const std::vector<std::string>& topics);
Result unsubscribe();
Result receive(Message& msg);
std::shared_ptr<void> receive_proto(ConsumerType consumer_type);
Result acknowledge(const Message& message);
Result close();
const Consumer&
consumer() const {return consumer_; }
private:
Consumer consumer_;
std::shared_ptr<pulsar::Client> client_;
ConsumerConfiguration config_;
std::string subscription_name_;
};
}
}