BewareMyPower commented on code in PR #257:
URL: https://github.com/apache/pulsar-client-cpp/pull/257#discussion_r1178544663


##########
include/pulsar/Message.h:
##########
@@ -177,7 +177,14 @@ class PULSAR_PUBLIC Message {
     bool hasSchemaVersion() const;
 
     /**
-     * Get the schema version
+     * Get the schema version.
+     *
+     * @return the the schema version on success or -1 if the message does not 
have the schema version
+     */
+    int64_t getLongSchemaVersion() const;

Review Comment:
   Yes. The Java API design is terrible. It really harms the user experience. 
Actually the byte array always represents a big-endian encoded 8 bytes integer, 
unless it's empty, which indicates no schema version. I believe it's a mistake 
made by the author. You can also see `Schemas#getSchemaInfo` in the 
`pulsar-admin` module, you can see the parameter type is long.
   
   ```java
       SchemaInfo getSchemaInfo(String topic, long version) throws 
PulsarAdminException;
   
       CompletableFuture<SchemaInfo> getSchemaInfoAsync(String topic, long 
version);
   ```
   
   However, there is no document that tell users how to get the human-readable 
representation of the byte array. Returning a byte array is definitely a 
mistake. The Python client also wraps this API and returns a string to users. 
And the users can nearly do nothing with it.
   
   I will open a discussion later in the mail list. But for now, I think it's 
good to add such a method.



-- 
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]

Reply via email to