Defined in: index.d.ts:496
Schema Registry is a client for Schema Registry and handles serdes.
// In init context
const writer = new Writer({
brokers: ["localhost:9092"],
topic: "my-topic",
autoCreateTopic: true,
});
const schemaRegistry = new SchemaRegistry({
url: "localhost:8081",
});
const keySchema = schemaRegistry.createSchema({
version: 0,
element: KEY,
subject: "...",
schema: "...",
schemaType: "AVRO",
});
const valueSchema = schemaRegistry.createSchema({
version: 0,
element: VALUE,
subject: "...",
schema: "...",
schemaType: "AVRO",
});
// In VU code (default function)
writer.produce({
messages: [
{
key: schemaRegistry.serialize({
data: "key",
schema: keySchema,
schemaType: SCHEMA_TYPE_AVRO,
}),
value: schemaRegistry.serialize({
data: "value",
schema: valueSchema,
schemaType: SCHEMA_TYPE_AVRO,
}),
},
],
});new SchemaRegistry(
schemaRegistryConfig):SchemaRegistry
Defined in: index.d.ts:503
Schema Registry configuration.
SchemaRegistry
- SchemaRegistry instance.
createSchema(
schema):Schema
Defined in: index.d.ts:517
Schema configuration.
- Schema.
Create or update a schema on Schema Registry.
deserialize(
container):any
Defined in: index.d.ts:538
Container including data, schema and schemaType.
any
- Deserialized data as string, byte array or JSON object.
Deserializes the given data and schema into its original form.
getSchema(
schema):Schema
Defined in: index.d.ts:510
Schema configuration.
- Schema.
Get a schema from Schema Registry by version and subject.
getSubjectName(
subjectNameConfig):string
Defined in: index.d.ts:524
Subject name configuration.
string
- Subject name.
Returns the subject name for the given SubjectNameConfig.
serialize(
container):Uint8Array
Defined in: index.d.ts:531
Container including data, schema and schemaType.
Uint8Array
- Serialized data as byte array.
Serializes the given data and schema into a byte array.