pulsar-client-cpp
Loading...
Searching...
No Matches
MessageId.h
1
19#ifndef MESSAGE_ID_H
20#define MESSAGE_ID_H
21
22#include <iosfwd>
23#include <stdint.h>
24#include <memory>
25#include <string>
26#include <pulsar/defines.h>
27
28namespace pulsar {
29
30class MessageIdImpl;
31
32class PULSAR_PUBLIC MessageId {
33 public:
34 MessageId& operator=(const MessageId&);
35 MessageId();
36
45 explicit MessageId(int32_t partition, int64_t ledgerId, int64_t entryId, int32_t batchIndex);
46
50 static const MessageId& earliest();
51
55 static const MessageId& latest();
56
60 void serialize(std::string& result) const;
61
65 const std::string& getTopicName() const;
66
70 void setTopicName(const std::string& topicName);
71
75 static MessageId deserialize(const std::string& serializedMessageId);
76
77 // These functions compare the message order as stored in bookkeeper
78 bool operator<(const MessageId& other) const;
79 bool operator<=(const MessageId& other) const;
80 bool operator>(const MessageId& other) const;
81 bool operator>=(const MessageId& other) const;
82 bool operator==(const MessageId& other) const;
83 bool operator!=(const MessageId& other) const;
84
85 int64_t ledgerId() const;
86 int64_t entryId() const;
87 int32_t batchIndex() const;
88 int32_t partition() const;
89
90 private:
91 friend class ConsumerImpl;
92 friend class ReaderImpl;
93 friend class Message;
94 friend class MessageImpl;
95 friend class Commands;
96 friend class PartitionedProducerImpl;
97 friend class PartitionedConsumerImpl;
98 friend class MultiTopicsConsumerImpl;
99 friend class UnAckedMessageTrackerEnabled;
100 friend class BatchAcknowledgementTracker;
101 friend class PulsarWrapper;
102 friend class PulsarFriend;
103 friend class NegativeAcksTracker;
104
105 friend PULSAR_PUBLIC std::ostream& operator<<(std::ostream& s, const MessageId& messageId);
106
107 typedef std::shared_ptr<MessageIdImpl> MessageIdImplPtr;
108 MessageIdImplPtr impl_;
109};
110} // namespace pulsar
111
112#endif // MESSAGE_ID_H
Definition: Message.h:42
Definition: MessageId.h:32
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:30