@theagilemonkeys/plasmido-schema-registry
TypeScript icon, indicating that this package has built-in type declarations

0.1.5 • Public • Published

Plasmido Schema Registry

Project forked from https://github.com/kafkajs/confluent-schema-registry

  • "name": "@kafkajs/confluent-schema-registry",
  • "version": "3.0.1",

Simplified version that includes some extra methods for Plasmido app

confluent-schema-registry

@kafkajs/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.

Build Status

Getting started

npm install @kafkajs/confluent-schema-registry
# yarn add @kafkajs/confluent-schema-registry
const { Kafka } = require('kafkajs')
const { SchemaRegistry } = require('@kafkajs/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!

License

See LICENSE for more details.

Package Sidebar

Install

npm i @theagilemonkeys/plasmido-schema-registry

Weekly Downloads

4

Version

0.1.5

License

Apache-2.0

Unpacked Size

150 kB

Total Files

97

Last publish

Collaborators

  • agilemonkeys
  • javiertoledo
  • alvaroloes
  • nickseagull
  • charlietfe
  • rdoria
  • sperezp
  • rdiaz_theam
  • otoumas
  • gjaubert
  • davidtheam
  • tainguyenbui
  • marcastr0
  • juanjoman
  • adrian.gonzalez