pulsar-client-cpp
Loading...
Searching...
No Matches
Producer.h
1
19#ifndef PRODUCER_HPP_
20#define PRODUCER_HPP_
21
22#include <pulsar/defines.h>
23#include <pulsar/ProducerConfiguration.h>
24#include <memory>
25#include <stdint.h>
26
27namespace pulsar {
28class ProducerImplBase;
29class PulsarWrapper;
30class PulsarFriend;
31
32typedef std::function<void(Result)> FlushCallback;
33typedef std::shared_ptr<ProducerImplBase> ProducerImplBasePtr;
34
35class PULSAR_PUBLIC Producer {
36 public:
41
45 const std::string& getTopic() const;
46
50 const std::string& getProducerName() const;
51
57 Result send(const Message& msg);
58
83 Result send(const Message& msg, MessageId& messageId);
84
99 void sendAsync(const Message& msg, SendCallback callback);
100
106
111 void flushAsync(FlushCallback callback);
112
125 int64_t getLastSequenceId() const;
126
135 const std::string& getSchemaVersion() const;
136
147
155 void closeAsync(CloseCallback callback);
156
160 bool isConnected() const;
161
162 private:
163 explicit Producer(ProducerImplBasePtr);
164
165 friend class ClientImpl;
166 friend class PulsarFriend;
167 friend class PulsarWrapper;
168
169 ProducerImplBasePtr impl_;
170
171 // For unit test case BatchMessageTest::producerFailureResult only
172 void producerFailMessages(Result result);
173};
174} // namespace pulsar
175
176#endif /* PRODUCER_HPP_ */
Definition: Message.h:42
Definition: MessageId.h:32
Definition: Producer.h:35
bool isConnected() const
const std::string & getSchemaVersion() const
void flushAsync(FlushCallback callback)
Result send(const Message &msg, MessageId &messageId)
void closeAsync(CloseCallback callback)
void sendAsync(const Message &msg, SendCallback callback)
int64_t getLastSequenceId() const
const std::string & getTopic() const
const std::string & getProducerName() const
Result send(const Message &msg)
Definition: Authentication.h:30
Result
Definition: Result.h:31