Gleiphir2769 opened a new pull request, #972: URL: https://github.com/apache/pulsar-client-go/pull/972
### Motivation `toTrackingMessageID()` is a function that is widely used in `consumer` implementation. It is to convert an interface type `MessageID` into an struct type `trackingMessageID`. But the second return value of this function is redundant and confusing. For example. https://github.com/apache/pulsar-client-go/blob/e2ea255052e8a527091791ef368851d885ee2d45/pulsar/consumer_partition.go#L470-L473 https://github.com/apache/pulsar-client-go/blob/e2ea255052e8a527091791ef368851d885ee2d45/pulsar/consumer_partition.go#L529-L532 https://github.com/apache/pulsar-client-go/blob/e2ea255052e8a527091791ef368851d885ee2d45/pulsar/consumer_partition.go#L588-L591 The second return value indicates whether the `MessageID` is one of the following types `trackingMessageID`, `messageID` or `chunkingMessageID`. But `toTrackingMessageID` is not a public function, the limitation of type is useless. Currently, the second return value will always be true. https://github.com/apache/pulsar-client-go/blob/e2ea255052e8a527091791ef368851d885ee2d45/pulsar/impl_message.go#L235-L252 Therefore, I reimplemented `toTrackingMessageID` and redefines the meaning of the second return value. It means whether the returned `trackingMessageID` is converted from trackingMessageID. So it can indicate whether we need to pay attention to batch processing because `trackingMessageID` is actually a `batchMessageID` implementation. ### Modifications - Refactor the `toTrackingMessageID()` - Remove the redundant return value judgment in `consumer`, `partitionConsumer`... ### Verifying this change - [x] Make sure that the change passes the CI checks. ### Documentation - Does this pull request introduce a new feature? no -- 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]
