eolivelli opened a new pull request #11303:
URL: https://github.com/apache/pulsar/pull/11303


   ### Motivation
   
   Currently (Pulsar 2.8.0) it is not easy to produce messages with KeyValue 
encoding, because command line tools do not provide such support.
   With this change the user will be able to set the schema while using 
`pulsar-client produce` 
   
   We are adding three parameters:
   * "--key-schema" : this is the schema for the Key (default :"string")
   * "--value-schema": this is the schema for the Value (default: "bytes")
   * "--key-value-encoding-type": this is the type of encoding with values: 
none,separated,inline
   with key-value-encoding-type=node (default behaviour) we are not using KV 
encoding
   
   The command is 100% compatible with previous versions
   
   ### Modifications
   
   Add support for the properties listed above.
   We are using "Schema.AUTO_PRODUCE_BYTES" in order to deal with the Schema 
registry.
   The user will pass the raw value as message and we are passing it without 
modifications to Pulsar.
   
   Example command to send a KV message with JSON key and value:
   `bin/pulsar-client produce --key-value-encoding-type separated -k 
'{"a":"b"}' -m '{"a":"b"}' --key-schema 'json:{"type": "record","namespace": 
"com.example","name": "FullName", "fields": [{ "name": "a", "type": "string" 
}]} '  --value-schema 'json:{"type": "record","namespace": 
"com.example","name": "FullName", "fields": [{ "name": "a", "type": "string" 
}]} ' test`
   
   for AVRO and JSON the schema is written inline after the prefix "avro:" and 
"json:"
   
   ### Verifying this change
   
   This change added unit tests
   
   ### Documentation
   
   This change needs updates in the documentation, but in 2.9.0 we are going to 
produce automatically the doc for the CLI tools


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