This document defines how to describe Kafka-specific information on AsyncAPI.
Current version is 0.3.0
.
This object contains information about the server representation in Kafka.
servers:
production:
bindings:
kafka:
schemaRegistryUrl: 'https://my-schema-registry.com'
schemaRegistryVendor: 'confluent'
bindingVersion: '0.3.0'
This object contains information about the channel representation in Kafka (eg. a Kafka topic).
This object MUST contain only the properties defined above.
This example is valid for any Confluent compatible schema registry. Here we describe the implementation using the first 4 bytes in payload to store schema identifier.
channels:
user-signedup:
bindings:
kafka:
topic: 'my-specific-topic-name'
partitions: 20
replicas: 3
bindingVersion: '0.3.0'
This object contains information about the operation representation in Kafka (eg. the way to consume messages)
Field Name | Type | Description | Applicability [default] | Constraints |
---|---|---|---|---|
groupId |
Schema Object | Id of the consumer group. | OPTIONAL | - |
clientId |
Schema Object | Id of the consumer inside a consumer group. | OPTIONAL | - |
bindingVersion |
string | The version of this binding. If omitted, "latest" MUST be assumed. | OPTIONAL [latest ] |
- |
This object MUST contain only the properties defined above.
channels:
user-signedup:
subscribe:
bindings:
kafka:
groupId:
type: string
enum: ['myGroupId']
clientId:
type: string
enum: ['myClientId']
bindingVersion: '0.3.0'
This object contains information about the message representation in Kafka.
Field Name | Type | Description |
---|---|---|
key |
Schema Object | AVRO Schema Object | The message key. NOTE: You can also use the reference object way. |
schemaIdLocation |
string | If a Schema Registry is used when performing this operation, tells where the id of schema is stored (e.g. header or payload ). |
schemaIdPayloadEncoding |
string | Number of bytes or vendor specific values when schema id is encoded in payload (e.g confluent / apicurio-legacy / apicurio-new ). |
schemaLookupStrategy |
string | Freeform string for any naming strategy class to use. Clients should default to the vendor default if not supplied. |
bindingVersion |
string | The version of this binding. If omitted, "latest" MUST be assumed. |
This object MUST contain only the properties defined above.
This example is valid for any Confluent compatible schema registry. Here we describe the implementation using the first 4 bytes in payload to store schema identifier.
channels:
test:
publish:
message:
bindings:
kafka:
key:
type: string
enum: ['myKey']
schemaIdLocation: 'payload'
schemaIdPayloadEncoding: '4'
bindingVersion: '0.3.0'
This is another example that describes the use if Apicurio schema registry. We describe the apicurio-new
way of serializing without details on how it's implemented. We reference a specific lookup strategy that may be used to retrieve schema Id from registry during serialization.
channels:
test:
publish:
message:
bindings:
kafka:
key:
type: string
enum: ['myKey']
schemaIdLocation: 'payload'
schemaIdPayloadEncoding: 'apicurio-new'
schemaLookupStrategy: 'TopicIdStrategy'
bindingVersion: '0.3.0'