Skip to content

Commit

Permalink
feat: updated kafka topic configuration object
Browse files Browse the repository at this point in the history
  • Loading branch information
gokerakc committed Jan 29, 2024
1 parent 306f1fc commit 28d3554
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions kafka/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This document defines how to describe Kafka-specific information on AsyncAPI.

## Version

Current version is `0.4.0`.
Current version is `0.5.0`.


<a name="server"></a>
Expand All @@ -32,7 +32,7 @@ servers:
kafka:
schemaRegistryUrl: 'https://my-schema-registry.com'
schemaRegistryVendor: 'confluent'
bindingVersion: '0.4.0'
bindingVersion: '0.5.0'
```
Expand Down Expand Up @@ -71,7 +71,7 @@ channels:
retention.bytes: 1000000000
delete.retention.ms: 86400000
max.message.bytes: 1048588
bindingVersion: '0.4.0'
bindingVersion: '0.5.0'
```
<a name="topicConfiguration"></a>
## TopicConfiguration Object
Expand All @@ -85,8 +85,12 @@ Field Name | Type |
<a name="topicConfigurationRetentionBytes"></a>`retention.bytes` | integer | The [`retention.bytes`](https://kafka.apache.org/documentation/#topicconfigs_retention.bytes) configuration option. | OPTIONAL | see kafka documentation
<a name="topicConfigurationDeleteRetentionBytes"></a>`delete.retention.ms` | integer | The [`delete.retention.ms`](https://kafka.apache.org/documentation/#topicconfigs_delete.retention.ms) configuration option. | OPTIONAL | see kafka documentation
<a name="topicConfigurationMaxMessageBytes"></a>`max.message.bytes` | integer | The [`max.message.bytes`](https://kafka.apache.org/documentation/#topicconfigs_max.message.bytes) configuration option. | OPTIONAL | see kafka documentation
<a name="topicConfigurationSchemaKeyValidationEnabled"></a>`schema.key.validation.enabled` | boolean | It shows whether the schema validation for the message key is enabled. | OPTIONAL | -
<a name="topicConfigurationSchemaKeyLookupStrategy"></a>`schema.key.lookup.strategy` | string | The name of the schema lookup strategy for the message key. | OPTIONAL | Clients should default to the vendor default if not supplied.
<a name="topicConfigurationSchemaValueValidationEnabled"></a>`schema.value.validation.enabled` | boolean | It shows whether the schema validation for the message value is enabled. | OPTIONAL | -
<a name="topicConfigurationSchemaValueLookupStrategy"></a>`schema.value.lookup.strategy` | string | The name of the schema lookup strategy for the message value. | OPTIONAL | Clients should default to the vendor default if not supplied.

This object MUST contain only the properties defined above.
This object MAY contain the properties defined above including optional additional properties.

##### Example

Expand All @@ -97,6 +101,10 @@ topicConfiguration:
retention.bytes: 1000000000
delete.retention.ms: 86400000
max.message.bytes: 1048588
schema.key.validation.enabled: true
schema.key.lookup.strategy: "TopicNameStrategy"
schema.value.validation.enabled: true
schema.value.lookup.strategy: "TopicNameStrategy"
```

<a name="operation"></a>
Expand Down Expand Up @@ -131,7 +139,7 @@ operations:
clientId:
type: string
enum: ['myClientId']
bindingVersion: '0.4.0'
bindingVersion: '0.5.0'
```


Expand All @@ -143,13 +151,13 @@ This object contains information about the message representation in Kafka.

##### Fixed Fields

Field Name | Type | Description
---|:---:|---
<a name="messageBindingObjectKey"></a>`key` | [Schema Object][schemaObject] \| [Reference Object](referenceObject) \| [AVRO Schema Object](https://avro.apache.org/docs/current/spec.html) | The message key. **NOTE**: You can also use the [reference object](referenceObject) way.
Field Name | Type | Description | Applicability [default] | Constraints
---|:-------:|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:-----------------------:|---
<a name="messageBindingObjectKey"></a>`key` | [Schema Object][schemaObject] \| [Reference Object](referenceObject) \| [AVRO Schema Object](https://avro.apache.org/docs/current/spec.html) | The message key. **NOTE**: You can also use the [reference object](referenceObject) way. | OPTIONAL | -
<a name="messageBindingObjectSchemaIdLocation"></a>`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`). | OPTIONAL | MUST NOT be specified if `schemaRegistryUrl` is not specified at the Server level
<a name="messageBindingObjectSchemaIdPayloadEncoding"></a>`schemaIdPayloadEncoding` | string | Number of bytes or vendor specific values when schema id is encoded in payload (e.g `confluent`/ `apicurio-legacy` / `apicurio-new`). | OPTIONAL | MUST NOT be specified if `schemaRegistryUrl` is not specified at the Server level
<a name="messageBindingObjectSchemaLookupStrategy"></a>`schemaLookupStrategy` | string | Freeform string for any naming strategy class to use. Clients should default to the vendor default if not supplied. | OPTIONAL | MUST NOT be specified if `schemaRegistryUrl` is not specified at the Server level
<a name="messageBindingObjectBindingVersion"></a>`bindingVersion` | string | The version of this binding. If omitted, "latest" MUST be assumed.
<a name="messageBindingObjectBindingVersion"></a>`bindingVersion` | string | The version of this binding. If omitted, "latest" MUST be assumed. | OPTIONAL [`latest`] | -

This object MUST contain only the properties defined above.

Expand All @@ -168,7 +176,7 @@ channels:
enum: ['myKey']
schemaIdLocation: 'payload'
schemaIdPayloadEncoding: '4'
bindingVersion: '0.4.0'
bindingVersion: '0.5.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](https://www.apicur.io/registry/docs/apicurio-registry/2.2.x/getting-started/assembly-using-kafka-client-serdes.html#registry-serdes-concepts-strategy_registry) that may be used to retrieve schema Id from registry during serialization.
Expand All @@ -187,7 +195,7 @@ channels:
schemaIdLocation: 'payload'
schemaIdPayloadEncoding: 'apicurio-new'
schemaLookupStrategy: 'TopicIdStrategy'
bindingVersion: '0.4.0'
bindingVersion: '0.5.0'
```

[schemaObject]: https://www.asyncapi.com/docs/reference/specification/v3.0.0-next-major-spec.15#schemaObject
Expand Down

0 comments on commit 28d3554

Please sign in to comment.