harness.kafka.KafkaConfig.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of harness-kafka_3 Show documentation
Show all versions of harness-kafka_3 Show documentation
Miscellaneous libraries/utilities for Scala.
The newest version!
package harness.kafka
import zio.json.*
final case class KafkaConfig(
zookeeper: KafkaConfig.Zookeeper,
broker: KafkaConfig.Broker,
)
object KafkaConfig {
final case class Zookeeper(
port: Option[Int],
) { self =>
object withDefaults {
def port: Int = self.port.getOrElse(2181)
}
}
object Zookeeper {
implicit val jsonCodec: JsonCodec[Zookeeper] = DeriveJsonCodec.gen
}
final case class Broker(
plainTextHost: String,
plainTextPort: Option[Int],
plainTextHostPort: Option[Int],
) { self =>
object withDefaults {
def plainTextPort: Int = self.plainTextPort.getOrElse(29092)
def plainTextHostPort: Int = self.plainTextHostPort.getOrElse(9092)
}
}
object Broker {
implicit val jsonCodec: JsonCodec[Broker] = DeriveJsonCodec.gen
}
implicit val jsonCodec: JsonCodec[KafkaConfig] = DeriveJsonCodec.gen
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy