MessageKeyType
The type of data stored in message keys.
Possible Values
Null, Binary, String, Long, Integer, Float, Double, Avro, CSV, CSV_WITH_HEADERS, XML, JSON, AutoData Type
string
Default Value
"Null"
Remarks
By default the driver does not report message keys. To enable message keys, this property must be set to a value other than Null and MessageKeyColumn must be set to a valid column name.
See Extracting Metadata From Topics for a description of how this interacts with the TypeDetectionScheme property. SerializationFormat describes how each of these supported formats is encoded. There are three main differences between how that property and this property work:
- Complex key columns are always prefixed with MessageKeyColumn and a dot, while primitive key columns use MessageKeyColumn as their name. For example, if MessageKeyColumn is Key, an Avro key would expose columns like Key.field1. A string key would be expose a single column called Key.
- SerializationFormat uses NONE for binary fields while this property uses Binary.
- The driver only supports reading key schemas from the registry when connected to a Confluent RegistryService. Confluent registries use a naming convention that allows for both key and value schemas that cover the same topic.
This property is also the prerequisite and format for per-statement message keys set through the reserved MessageKeyColumn and MessageKeyColumnValue INSERT columns (see MessageKeyColumn). The key format is available both at the connection-level to be uniform across topics, or at the statement level which allows for more granular control of the key type. When set at the statement level and using the batch functionality the type must be uniform across all INSERTs. Setting either reserved column while this property is Null is a configuration error, and the literal MessageKeyColumnValue form additionally requires a primitive type (String, Long, Integer, Float, or Double). In addition when the TypeDetectionScheme is set to RowScan, this property cannot be set to AVRO.