pulsar-client-cpp
Loading...
Searching...
No Matches
MessageBuilder.h
1
19#ifndef MESSAGE_BUILDER_H
20#define MESSAGE_BUILDER_H
21
22#include <pulsar/KeyValue.h>
23#include <pulsar/Message.h>
24#include <pulsar/defines.h>
25
26#include <chrono>
27#include <string>
28#include <vector>
29
30namespace pulsar {
31class PulsarWrapper;
32
33class PULSAR_PUBLIC MessageBuilder {
34 public:
36
37 typedef std::map<std::string, std::string> StringMap;
38
43
47 MessageBuilder& setContent(const void* data, size_t size);
48
55 MessageBuilder& setContent(const std::string& data);
56
62 MessageBuilder& setContent(std::string&& data);
63
70
76 MessageBuilder& setAllocatedContent(void* data, size_t size);
77
83 MessageBuilder& setProperty(const std::string& name, const std::string& value);
84
88 MessageBuilder& setProperties(const StringMap& properties);
89
94 MessageBuilder& setPartitionKey(const std::string& partitionKey);
95
100 MessageBuilder& setOrderingKey(const std::string& orderingKey);
101
107 MessageBuilder& setDeliverAfter(const std::chrono::milliseconds delay);
108
115 MessageBuilder& setDeliverAt(uint64_t deliveryTimestamp);
116
120 MessageBuilder& setEventTimestamp(uint64_t eventTimestamp);
121
138 MessageBuilder& setSequenceId(int64_t sequenceId);
139
150 MessageBuilder& setReplicationClusters(const std::vector<std::string>& clusters);
151
158
164
165 protected:
166 const char* data() const;
167 std::size_t size() const;
168
169 private:
170 void checkMetadata();
171 static std::shared_ptr<MessageImpl> createMessageImpl();
172 Message::MessageImplPtr impl_;
173
174 friend class PulsarWrapper;
175};
176} // namespace pulsar
177
178#endif
Definition KeyValue.h:35
Definition MessageBuilder.h:33
MessageBuilder & setDeliverAt(uint64_t deliveryTimestamp)
MessageBuilder & setPartitionKey(const std::string &partitionKey)
MessageBuilder & setContent(const void *data, size_t size)
MessageBuilder & setAllocatedContent(void *data, size_t size)
MessageBuilder & setDeliverAfter(const std::chrono::milliseconds delay)
MessageBuilder & setEventTimestamp(uint64_t eventTimestamp)
MessageBuilder & setOrderingKey(const std::string &orderingKey)
MessageBuilder & setContent(const KeyValue &data)
MessageBuilder & setContent(std::string &&data)
MessageBuilder & setProperties(const StringMap &properties)
MessageBuilder & setSequenceId(int64_t sequenceId)
MessageBuilder & create()
MessageBuilder & setReplicationClusters(const std::vector< std::string > &clusters)
MessageBuilder & setProperty(const std::string &name, const std::string &value)
MessageBuilder & setContent(const std::string &data)
MessageBuilder & disableReplication(bool flag)
Definition Message.h:44
Definition Authentication.h:31