Home

Awesome

Scala Steward badge

SBT Schema Registry Plugin

Sbt plugin for download schemas from schema registry. This plugin adds a new task schemaRegistryDownload for downloading schemas and some configuration parameters to declare schemas and schema registry endpoint

Usage

To activate the plugin, you need to add the following lines to your project/plugins.sbt file:

resolvers ++= Seq(
  // this resolver needed for load plugin dependencies
  "Confluent" at "https://packages.confluent.io/maven/",
)

addSbtPlugin("org.galaxio" % "sbt-schema-registry-plugin" % "<plugin-version>")

And next you need added this configuration in build.sbt

import org.galaxio.avro.RegistrySubject

val schemas = Seq(
  RegistrySubject("hello.world.schema", 2),
  RegistrySubject("schema1-name", 12),
  RegistrySubject("<schema-name>", <schema-version>),
    )

    val someProject = (project in file("."))
    .settings(
    ...,
    schemaRegistrySubjects ++= schemas,
    schemaRegistryUrl := "http://
    <schema-registry-host>:
      <schema-registry-port>",
        ...
        )

Then you can download schemes listed in schemaRegistrySubjects from schema registry by url from schemaRegistryUrl with help a task schemaRegistryDownload

sbt schemaRegistryDownload

Settings

To configure the plugin to interact with the schema registry the following parameters are used

ParameterDescriptionDefault value
schemaRegistrySubjectslist schema subjects name with versionSeq()
schemaRegistryUrlurl of schema registryhttp://locahost:8081
schemaRegistryTargetFolderOutput directory for dowloading schemas./src/main/avro