Skip to main content

Generator configuration

kafkaKeyProtobufHint

Commentary

added in 0.8.5

local configuration

Deprecated: See protobufSchemaHint instead.

When using the Kafka Protobuf serializer, explicitly defines the Protobuf schema and message for the record key.


Examples

Setting the schema

Set kafkaKeyProtobufHint with two keys: schemaFile, which is a path inside the container to a file containing the Protobuf schema, and message, which is the Protobuf message to encode the record with.

{
"generators": [
{
"topic": "customers",
"key": {
"id": {
"_gen": "uuid"
}
},
"value": {
"_gen": "boolean"
},
"localConfigs": {
"kafkaKeyProtobufHint": {
"schemaFile": "/path/to/protobuf-schema.proto",
"message": "UserIdentifier"
}
}
}
],
"connections": {
"kafka": {
"kind": "kafka",
"producerConfigs": {
"bootstrap.servers": "localhost:9092",
"schema.registry.url": "http://localhost:8081",
"key.serializer": "io.confluent.kafka.serializers.protobuf.KafkaProtobufSerializer",
"value.serializer": "io.shadowtraffic.kafka.serdes.JsonSerializer"
}
}
}
}

Specification

JSON schema

{
"type": "object",
"properties": {
"schemaFile": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"schemaFile",
"message"
]
}