merlimat commented on a change in pull request #225: Added an function to
serialize the messageID to string
URL: https://github.com/apache/pulsar-client-go/pull/225#discussion_r408900715
##########
File path: pulsar/impl_message.go
##########
@@ -93,6 +94,10 @@ func (id *messageID) Serialize() []byte {
data, _ := proto.Marshal(msgID)
return data
}
+func (id *messageID) SerializeToString() string {
+
+ return fmt.Sprintf("%d:%d:%d:%d", id.ledgerID, id.entryID, id.batchIdx,
id.partitionIdx)
Review comment:
My concern here is that we're exposing the String format in the API
directly. The string format itself shouldn't be used for any other purpose than
debug, since it's not guaranteed to be kept compatible.
For that, if the purpose of this is to print a message id on logs, wouldn't
that already work even without the `SerializeToString()`?
For example, check
https://github.com/apache/pulsar-client-go/blob/master/examples/consumer/consumer.go#L52-L53
There, all the internal components of the message id are going to get printed
on the log.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services