BewareMyPower commented on code in PR #17125:
URL: https://github.com/apache/pulsar/pull/17125#discussion_r953705163


##########
pulsar-client-cpp/tests/SchemaTest.cc:
##########
@@ -107,3 +107,60 @@ TEST(SchemaTest, testHasSchemaVersion) {
 
     client.close();
 }
+
+TEST(SchemaTest, testKeyValueSchema) {
+    // 0. test key value only support JSON or AVRO.

Review Comment:
   > key value only support JSON or AVRO.
   
   It's wrong. Run the following Java application:
   
   ```java
           final String topic = "my-schema-topic-" + System.currentTimeMillis();
           @Cleanup
           PulsarClient client = 
PulsarClient.builder().serviceUrl("pulsar://localhost:6650").build();
   
           BiConsumer<KeyValueEncodingType, KeyValue<String, String>> send = 
(type, keyValue) -> {
               try (Producer<KeyValue<String, String>> producer = client
                       .newProducer(Schema.KeyValue(Schema.STRING, 
Schema.STRING, type)).topic(topic).create()) {
                   producer.send(keyValue);
               } catch (PulsarClientException e) {
                   throw new RuntimeException(e);
               }
           };
           send.accept(KeyValueEncodingType.INLINE, new KeyValue<>("key-0", 
"value-0"));
           send.accept(KeyValueEncodingType.SEPARATED, new KeyValue<>("key-1", 
"value-1"));
   ```
   
   Did you only see the `Schema#KeyValue` methods with `Class<?>` arguments? 
Maybe you can get more info from my email here: 
https://lists.apache.org/thread/4r3rmgjlxbgppfyglxyg6rfn6v42hvjf



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