Skip to content

ovotech/ciris-aiven-kafka

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Ciris Aiven Kafka

Aiven Kafka support for Ciris.

Getting Started

To get started with sbt, simply add the following lines to your build.sbt file.

resolvers += "Artifactory" at "https://kaluza.jfrog.io/artifactory/maven/"

libraryDependencies += "com.ovoenergy" %% "ciris-aiven-kafka" % "3.0.0"

The library is published for Scala 3.2.x, 2.13.x, and 2.12.x.

Usage

import ciris.aiven.kafka._ and use aivenKafkaSetup to set up the key and trust stores. Supplied credential strings are expected to be in PKCS 12 format.

import cats.effect.{ExitCode, IO, IOApp}
import cats.implicits._
import ciris._
import ciris.aiven.kafka._

object Main extends IOApp {
  def run(args: List[String]): IO[ExitCode] =
      aivenKafkaSetup(
        clientPrivateKey = env("CLIENT_PRIVATE_KEY"),
        clientCertificate = env("CLIENT_CERTIFICATE"),
        serviceCertificate = env("SERVICE_CERTIFICATE")
      ).load[IO]
    .as(ExitCode.Success)
}

If the configuration loading was successful, aivenKafkaSetup will return an AivenKafkaSetup with the key and trust store locations, and their passwords. Temporary files and passwords are used and the files are set to be deleted automatically on exit. The key store is of type PKCS12 and the trust store is of type JKS.

AivenKafkaSetup provides properties: Map[String, String] with suitable consumer properties.