Skip to main content

Generator configuration

schemaRegistrySubject

Commentary

added in 1.3.0

local configuration

Sets the exact subject name the Kafka connection should download from Schema Registry. This is particularly useful if you do not use the default TopicNameStrategy configuration.


Examples

Setting the subject name

Set schemaRegistrySubject to a map of attributes to names. The attributes represent the parts of the Kafka record to find subjects for (e.g. key and value), and the name represents the subject to find.

In this example, ShadowTraffic will use schemas for the subject named com.acme.MyRecord, which should already exist in Schema Registry.

{
"generators": [
{
"topic": "sandbox",
"value": {
"myField": {
"_gen": "boolean"
}
},
"localConfigs": {
"schemaRegistrySubject": {
"value": "com.acme.MyRecord"
}
}
}
],
"connections": {
"kafka": {
"kind": "kafka",
"producerConfigs": {
"bootstrap.servers": "localhost:9092",
"schema.registry.url": "http://localhost:8081",
"key.serializer": "io.confluent.kafka.serializers.KafkaAvroSerializer",
"value.serializer": "io.confluent.kafka.serializers.KafkaAvroSerializer",
"value.subject.name.strategy": "io.confluent.kafka.serializers.subject.RecordNameStrategy"
}
}
}
}

Specification

JSON schema

{
"type": "object"
}