BewareMyPower commented on a change in pull request #14604:
URL: https://github.com/apache/pulsar/pull/14604#discussion_r821783526
##########
File path: pulsar-client-cpp/include/pulsar/MessageId.h
##########
@@ -44,6 +45,12 @@ class PULSAR_PUBLIC MessageId {
*/
explicit MessageId(int32_t partition, int64_t ledgerId, int64_t entryId,
int32_t batchIndex);
+ /**
+ * Construct the ChunkMessageId with first and last message id's param
+ */
+ explicit MessageId(int32_t firstPartition, int64_t firstLedgerId, int64_t
firstEntryId, int32_t firstBatchIndex,
+ int32_t lastPartition, int64_t lastLedgerId, int64_t
lastEntryId, int32_t lastBatchIndex);
Review comment:
IMO, a better solution is adding a builder class and keep the current
constructor for backward compatibility.
```c++
// A simple MessageId, which is equivalent with Java's BatchMessageIdImpl
const auto msgId1 = MessageIdBuilder()
.ledgerId(0L)
.entryId(0L)
.batchIndex(1)
.build(); // the default partition index is -1
// A chunked MessageId, which is equivalent with Java's ChunkMessageIdImpl
const auto msgId2 = MessageIdBuilder()
.ledgerId(0L)
.entryId(0L)
.batchIndex(1)
.firstChunkMessageId(/* ... */)
.build();
```
But it will involve many changes. So I think in this PR, adding a
constructor that accepts two `MessageId` parameters is enough.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]