|
25 | 25 | #include <iostream> |
26 | 26 |
|
27 | 27 | #include "Int64SerDes.h" |
28 | | -#include "KeyValueImpl.h" |
29 | 28 | #include "MessageImpl.h" |
30 | | -#include "PulsarApi.pb.h" |
31 | | -#include "SharedBuffer.h" |
32 | 29 |
|
33 | 30 | using namespace pulsar; |
34 | 31 |
|
@@ -69,53 +66,7 @@ std::string Message::getDataAsString() const { return std::string((const char*)g |
69 | 66 |
|
70 | 67 | Message::Message() : impl_() {} |
71 | 68 |
|
72 | | -Message::Message(MessageImplPtr& impl) : impl_(impl) {} |
73 | | - |
74 | | -Message::Message(const MessageId& messageID, proto::BrokerEntryMetadata& brokerEntryMetadata, |
75 | | - proto::MessageMetadata& metadata, SharedBuffer& payload, |
76 | | - proto::SingleMessageMetadata& singleMetadata, const std::shared_ptr<std::string>& topicName) |
77 | | - : impl_(std::make_shared<MessageImpl>()) { |
78 | | - impl_->messageId = messageID; |
79 | | - impl_->brokerEntryMetadata = brokerEntryMetadata; |
80 | | - impl_->metadata = metadata; |
81 | | - impl_->payload = payload; |
82 | | - impl_->metadata.mutable_properties()->CopyFrom(singleMetadata.properties()); |
83 | | - impl_->topicName_ = topicName; |
84 | | - |
85 | | - impl_->metadata.clear_properties(); |
86 | | - if (singleMetadata.properties_size() > 0) { |
87 | | - impl_->metadata.mutable_properties()->Reserve(singleMetadata.properties_size()); |
88 | | - for (int i = 0; i < singleMetadata.properties_size(); i++) { |
89 | | - auto keyValue = proto::KeyValue().New(); |
90 | | - *keyValue = singleMetadata.properties(i); |
91 | | - impl_->metadata.mutable_properties()->AddAllocated(keyValue); |
92 | | - } |
93 | | - } |
94 | | - |
95 | | - if (singleMetadata.has_partition_key()) { |
96 | | - impl_->metadata.set_partition_key(singleMetadata.partition_key()); |
97 | | - } else { |
98 | | - impl_->metadata.clear_partition_key(); |
99 | | - } |
100 | | - |
101 | | - if (singleMetadata.has_ordering_key()) { |
102 | | - impl_->metadata.set_ordering_key(singleMetadata.ordering_key()); |
103 | | - } else { |
104 | | - impl_->metadata.clear_ordering_key(); |
105 | | - } |
106 | | - |
107 | | - if (singleMetadata.has_event_time()) { |
108 | | - impl_->metadata.set_event_time(singleMetadata.event_time()); |
109 | | - } else { |
110 | | - impl_->metadata.clear_event_time(); |
111 | | - } |
112 | | - |
113 | | - if (singleMetadata.has_sequence_id()) { |
114 | | - impl_->metadata.set_sequence_id(singleMetadata.sequence_id()); |
115 | | - } else { |
116 | | - impl_->metadata.clear_sequence_id(); |
117 | | - } |
118 | | -} |
| 69 | +Message::Message(const MessageImplPtr& impl) : impl_(impl) {} |
119 | 70 |
|
120 | 71 | const MessageId& Message::getMessageId() const { |
121 | 72 | if (!impl_) { |
|
0 commit comments