ovotech / comms-kafka-messages

Classes and auto-generated Avro schemas for comms platform Kafka messages

GitHub

Comms platform Kafka messages

CircleCI

Download

Scala classes representing the various Kakfa messages the platform sends and receives.

This project is in charge of:

  • auto-generating Avro schemas from the classes using avro4s
  • verifying that the schemas are compatible with the previous versions, using the schema registry
  • publishing the classes to Bintray

How to use the Scala classes

Add a resolver in sbt for the Maven repo on Bintray:

resolvers += Resolver.bintrayRepo("ovotech", "maven")

Then add a dependency on the library:

libraryDependencies += "com.ovoenergy" %% "comms-kafka-messages" % "version"

See the Bintray badge above for the latest version.

How to release

Create and push a git tag called circleci-release. This will trigger CircleCI to release a new version of the library.

$ git tag circleci-release
$ git push --tags

CircleCI will take care of deleting the tag so it can be re-used for the next release.

Manual releases

If you want to release a new version from your local machine for whatever reason, you will need to be a member of the ovotech organisation on Bintray.

$ sbt release

will run the tests, bump the version, verify the schema compatibility, build all the artifacts and publish them to Bintray.

The first time you run it, you will need to configure sbt with your Bintray credentials beforehand: $ sbt bintrayChangeCredentials

Schema compatibility checks

When CircleCI builds a PR, it generates the Avro schemas for all Kafka messages.

It then asks the schema registry to verify that each schema is compatible with its respective previous version (if a previous version exists).

If any schema change is incompatible, the build will fail.

As part of the release process, the latest version of all schemas will be registered with the schema registry.