pulsar-client-cpp
Loading...
Searching...
No Matches
MessageId.h
1
19#ifndef MESSAGE_ID_H
20#define MESSAGE_ID_H
21
22#include <pulsar/defines.h>
23#include <stdint.h>
24
25#include <iosfwd>
26#include <memory>
27#include <string>
28#include <vector>
29
30namespace pulsar {
31
32class MessageIdImpl;
33
34class PULSAR_PUBLIC MessageId {
35 public:
36 MessageId& operator=(const MessageId&);
37 MessageId();
38
51 explicit MessageId(int32_t partition, int64_t ledgerId, int64_t entryId, int32_t batchIndex);
52
56 static const MessageId& earliest();
57
61 static const MessageId& latest();
62
66 void serialize(std::string& result) const;
67
71 const std::string& getTopicName() const;
72
76 void setTopicName(const std::string& topicName);
77
81 static MessageId deserialize(const std::string& serializedMessageId);
82
83 // These functions compare the message order as stored in bookkeeper
84 bool operator<(const MessageId& other) const;
85 bool operator<=(const MessageId& other) const;
86 bool operator>(const MessageId& other) const;
87 bool operator>=(const MessageId& other) const;
88 bool operator==(const MessageId& other) const;
89 bool operator!=(const MessageId& other) const;
90
91 int64_t ledgerId() const;
92 int64_t entryId() const;
93 int32_t batchIndex() const;
94 int32_t partition() const;
95 int32_t batchSize() const;
96
97 private:
98 friend class ConsumerImpl;
99 friend class ReaderImpl;
100 friend class Message;
101 friend class MessageImpl;
102 friend class Commands;
103 friend class PartitionedProducerImpl;
104 friend class MultiTopicsConsumerImpl;
105 friend class UnAckedMessageTrackerEnabled;
106 friend class BatchAcknowledgementTracker;
107 friend class PulsarWrapper;
108 friend class PulsarFriend;
109 friend class NegativeAcksTracker;
110 friend class MessageIdBuilder;
111
112 friend PULSAR_PUBLIC std::ostream& operator<<(std::ostream& s, const MessageId& messageId);
113
114 typedef std::shared_ptr<MessageIdImpl> MessageIdImplPtr;
115 MessageIdImplPtr impl_;
116
117 explicit MessageId(const MessageIdImplPtr& impl);
118};
119
120typedef std::vector<MessageId> MessageIdList;
121} // namespace pulsar
122
123#endif // MESSAGE_ID_H
Definition: Message.h:43
Definition: MessageIdBuilder.h:54
Definition: MessageId.h:34
static MessageId deserialize(const std::string &serializedMessageId)
static const MessageId & earliest()
void setTopicName(const std::string &topicName)
const std::string & getTopicName() const
MessageId(int32_t partition, int64_t ledgerId, int64_t entryId, int32_t batchIndex)
void serialize(std::string &result) const
static const MessageId & latest()
Definition: Authentication.h:31