-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/v2.1.3' into main
- Loading branch information
Showing
9 changed files
with
279 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
"aklivity", | ||
"ALIES", | ||
"alpn", | ||
"apicurio", | ||
"APIs", | ||
"artifacthub", | ||
"asyncapi", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
[{"text":"Latest","icon":"fas fa-home","key":"latest","tag":"v2.1.2"}] | ||
[{"text":"Latest","icon":"fas fa-home","key":"latest","tag":"v2.1.3"}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Models | ||
|
||
When Zilla interacts with the data inside of a message, it only parses the necessary metadata with standard formats. The processing of messages is simple and uses fewer resources to proxy data streams. A [`model`](../reference/config/models/) adds the type syntax or structure definitions that Zilla needs to deserialize the remaining message parts. | ||
|
||
## Primitive Models | ||
|
||
Primitive models will have additional properties based on the type used. | ||
|
||
```yaml | ||
model: string | ||
encoding: utf_8 | ||
``` | ||
> [Validating message keys](../how-tos/models/index.md#validating-message-keys) | [http.proxy.schema.inline example](https://github.com/aklivity/zilla-examples/tree/main/http.proxy.schema.inline) | ||
## Schema Models | ||
Schema-based models will reference a [catalog](./catalogs.md) to supply the binding with the configured model definition. Schemas referenced by their subject will fetch the latest version of that schema. | ||
- Fetch the latest schema by `subject`. | ||
|
||
```yaml | ||
model: avro | ||
catalog: | ||
my_catalog: | ||
- subject: my_schema_subject | ||
``` | ||
|
||
- Fetch the latest schema by the schema definition on a Kafka `topic`. | ||
|
||
```yaml | ||
model: avro | ||
catalog: | ||
my_catalog: | ||
- strategy: topic | ||
``` | ||
|
||
- Fetch a specific schema by its schema ID. | ||
|
||
```yaml | ||
model: avro | ||
catalog: | ||
my_catalog: | ||
- id: 42 | ||
``` | ||
|
||
> [Validating a new message](../how-tos/models/index.md#validating-a-new-message) | [Expose a different model format](../how-tos/models/index.md#expose-a-different-model-format) | [http.kafka.karapace example](https://github.com/aklivity/zilla-examples/tree/main/http.kafka.karapace) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Registering a Catalog | ||
|
||
A registered catalog is a namespace scoped item in a zilla config that can be reused throughout the config. | ||
|
||
## Local Catalogs | ||
|
||
Local catalogs are used to quickly bootstrap a Zilla config or package a standard schema that doesn't change often with a Zilla install. | ||
|
||
A simple way to reference a file in Zilla is from the local filesystem. Adding [files to a Zilla pod](../deploy-operate.md#adding-files-to-the-zilla-pod) relative to the Zilla install directory. | ||
|
||
```yaml | ||
catalogs: | ||
my_host_filesystem_catalog: | ||
type: filesystem | ||
options: | ||
subjects: | ||
local_file: | ||
path: relative/path/to/local.file | ||
``` | ||
In some environments the local filesystem isn't accessible. Schema subjects can be definined inside of the Zilla config to keep all of the relevant model information in one place. | ||
```yaml | ||
catalogs: | ||
my_inline_catalog: | ||
type: inline | ||
options: | ||
subjects: | ||
my_avro_subject: | ||
schema: | | ||
{ | ||
"type": "object", | ||
"properties": { | ||
"id": { | ||
"type": "integer" | ||
}, | ||
"status": { | ||
"type": "string" | ||
} | ||
}, | ||
"required": [ | ||
"id", | ||
"status" | ||
] | ||
} | ||
``` | ||
## Remote Catalogs | ||
Remote catalogs allow Zilla to fetch existing schemas stored in an external service. Zilla will pull and maintain an up to date version of the specified schema meaning the running Zilla doesn't need to be redeployed when new data models are pushed. Zilla can also reference specific versions. | ||
Registering remote catalogs is simple. Zilla needs to know the address for the registry and any relevant information about where the resources in the registry will be found. Once a remote catalog is registered the [model configs](../models/) will specify which resources and versions to fetch and use. | ||
```yaml | ||
catalogs: | ||
my_schema_registry_catalog: | ||
type: schema-registry | ||
options: | ||
url: ${{env.SCHEMA_REGISTRY_URL}} | ||
context: default | ||
my_apicurio_registry_catalog: | ||
type: apicurio-registry | ||
options: | ||
url: ${{env.APICURIO_URL}} | ||
group-id: my_group_id | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
# Structured Message data | ||
|
||
Adding structured types to the message data streams in Zilla. | ||
|
||
## Adding models structure to Kafka messages | ||
|
||
The `kafka` `cache_client` and `cache_server` bindings are responsible for interacting with the messages stored on Kafka topics. This is where Zilla can implement any structured type definitions. The schema for the message can come from the Kafka topic's schema definition using the topic `strategy` or be a reference to a schema's `subject` or `id`. The [catalog](../catalogs/index.md) definition will determine which methods are available when referencing schemas. | ||
|
||
### Validating message keys | ||
|
||
The message key for a topic can be set to any primitive model type and Zilla will validate the key when a message is Produced on a topic. | ||
|
||
```yaml | ||
north_kafka_cache_client: | ||
type: kafka | ||
kind: cache_client | ||
options: | ||
topics: | ||
- name: my-kafka-topic | ||
key: | ||
model: string | ||
``` | ||
### Validating a new message | ||
The `kafka cache_client` binding can parse the message value, or body of the message, that is Produced on a topic. | ||
|
||
```yaml | ||
north_kafka_cache_client: | ||
type: kafka | ||
kind: cache_client | ||
options: | ||
topics: | ||
- name: my-kafka-topic | ||
value: | ||
model: avro | ||
catalog: | ||
my_catalog: | ||
- strategy: topic | ||
``` | ||
|
||
### Enforcing a schema on Fetch | ||
|
||
The `kafka cache_server` can enforce a schema on messages Fetched from a topic. This will prevent any messages that are pruduced on a Kafka topic from getting cosumed by a client if that messages doesn't match to the specified schema. | ||
|
||
```yaml | ||
south_kafka_cache_server: | ||
type: kafka | ||
kind: cache_server | ||
options: | ||
bootstrap: | ||
- my-kafka-topic | ||
topics: | ||
- name: my-kafka-topic | ||
value: | ||
model: avro | ||
catalog: | ||
my_catalog: | ||
- strategy: topic | ||
``` | ||
|
||
### Expose a different model format | ||
|
||
The `kafka cache_client` can read the `view` model and translate it into the specified `model` for when a message is produced on the Kafka topic. Then the `kafka cache_server` can read the `model` from the topic and translate it into the `view` model. | ||
|
||
In this case the `view` model that clients interact with needs to be a JSON object but the topic `model` is a serialize Avro object. | ||
|
||
```yaml | ||
north_kafka_cache_client: | ||
type: kafka | ||
kind: cache_client | ||
options: | ||
topics: | ||
- name: my-kafka-topic | ||
value: | ||
model: avro | ||
view: json | ||
catalog: | ||
my_catalog: | ||
- strategy: topic | ||
exit: south_kafka_cache_server | ||
south_kafka_cache_server: | ||
type: kafka | ||
kind: cache_server | ||
options: | ||
bootstrap: | ||
- my-kafka-topic | ||
topics: | ||
- name: my-kafka-topic | ||
value: | ||
model: avro | ||
view: json | ||
catalog: | ||
my_catalog: | ||
- strategy: topic | ||
``` |