open-index/open-npm huggingface dataset:
npm package: @ovotech/confluent-schema-registry
Description: ConfluentSchemaRegistry is a library that makes it easier to interact with the Confluent schema registry, it provides convenient methods to encode, decode and register new schemas using the Apache Avro serialization format.
Latest version: 3.3.6

# confluent-schema-registry

`@ovotech/confluent-schema-registry` is a library that makes it easier to interact with the Confluent schema registry, it provides convenient methods to encode, decode and register new schemas using the Apache Avro serialization format and Confluent's [wire format](https://docs.confluent.io/current/schema-registry/docs/serializer-formatter.html#wire-format).

[![Build Status](https://dev.azure.com/tulios/ConfluentSchemaRegistry/_apis/build/status/kafkajs.confluent-schema-registry?branchName=master)](https://dev.azure.com/tulios/ConfluentSchemaRegistry/_build/latest?definitionId=3&branchName=master)

## Getting started

```sh
npm install @ovotech/confluent-schema-registry
# yarn add @ovotech/confluent-schema-registry
```

```javascript
const { Kafka } = require('kafkajs')
const { SchemaRegistry } = require('@ovotech/confluent-schema-registry')

const kafka = new Kafka({ clientId: 'my-app', brokers: ['kafka1:9092'] })
const registry = new SchemaRegistry({ host: 'http://registry:8081/' })
const consumer = kafka.consumer({ groupId: 'test-group' })

const run = async () => {
  await consumer.connect()
  await consumer.subscribe({ topic: 'test-topic', fromBeginning: true })

  await consumer.run({
    eachMessage: async ({ topic, partition, message }) => {
      const decodedKey = await registry.decode(message.key)
      const decodedValue = await registry.decode(message.value)
      console.log({ decodedKey, decodedValue })
    },
  })
}

run().catch(console.error)
```

## Documentation

Learn more about using [KafkaJS Confluent Schema registry on the official site!](https://kafkajs.github.io/confluent-schema-registry/)

## License

See [LICENSE](https://github.com/ovotech/confluent-schema-registry/blob/master/LICENSE) for more details.