start Kafka producer lazily

Signed-off-by: Sebastian Schüpbach's avatarSebastian Schüpbach <sebastian.schuepbach@unibas.ch>
parent 9fbfed77
Pipeline #19395 failed with stages
in 5 minutes and 7 seconds
......@@ -25,9 +25,9 @@ import org.apache.logging.log4j.scala.Logging
object App
extends Reporter
with scala.App
with AppSettings
with KConsumer
with MariadbIndexer
with AppSettings
with Logging {
try {
......
......@@ -27,7 +27,7 @@ import org.memobase.settings.SettingsLoader
import scala.collection.JavaConverters._
trait AppSettings {
lazy val settingsLoader = new SettingsLoader(
val settingsLoader = new SettingsLoader(
List(
"mariadbHost",
"mariadbPassword",
......
......@@ -31,7 +31,7 @@ import scala.util.{Failure, Success, Try}
abstract class Reporter {
self: AppSettings with Logging =>
private val producer = new KafkaProducer[String, String](producerProps)
private lazy val producer = new KafkaProducer[String, String](producerProps)
def reportResult(res: (String, Try[Int])): Unit = {
res._2 match {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment