Schema Registry
Note that this document assumes you have configured Schema Registry when adding a Cluster to your workspace. If you have not done this step, please refer to this section.
We currently support Avro, Protobuf and JSON schema registry types.
It's possible to produce and consume messages with a specified:
- Strategy
- Subject
- Version
Additionally, you can both filter and check messages consumed based on the Schema Id.
Producing a message with schema registry type
Add a Producer Task to the canvas editor.
On the General tab, specify the cluster and topic relevant to your scenario. Then, progress to the 'Data' tab of the form.
For either the key or value, select the format as the appropriate registry type from the dropdown list. You will then need to specify the Strategy, Subject and Version for producing a message.
When producing the message, you can either:
- Generate random data: This will infer the correct data types from your schema
- Manually enter data: Provide a manual input for the message
Consuming a message with schema registry type
Add a corresponding Consumer Task to the canvas editor.
On the General tab, specify the cluster and topic relevant to your scenario. Then, progress to the 'Data' tab of the form.
For either the key or value, select the format as the appropriate registry type from the dropdown list.
Filtering messages on Schema Id
When consuming messages, it's possible to filter messages based on a specified Schema Id.
When on the 'Data' tab for a Consumer task form, navigate to the Filters section.
Select the + button to add a new filter, and select Schema Id Filter.
Provide the Id in either the Key/Value Schema Id field. This will filter messages consumed that match the specified Id.
Checking the Schema Id
When making Test Checks in a scenario, it's possible to check the Key or Value Schema Id.
The syntax for accessing these values in a Consumer Task is outlined below:
JQ:
- Key Schema Id:
.record.keySchemaId
- Value Schema Id:
.record.valueSchemaId
JavaScript:
- Key Schema Id:
context.record.keySchemaId
- Value Schema Id:
context.record.valueSchemaId
Belo demonstrates how to use jq to create a test check on the Value Schema Id.