Hello,
I am using following code to create a plainsource consumer:
Config consumerConfig = config.getConfig("discovery-consumer");
log.info("creating plainsource consumer {} ", consumerConfig);
ConsumerSettings<String, String> settings = ConsumerSettings.create(consumerConfig, new StringDeserializer(), new StringDeserializer())
.withEnrichCompletionStage(DiscoverySupport.consumerBootstrapServers(config,getContext().getSystem()))
.withGroupId(kafkaConfig.GroupID)
.withProperty(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest")
.withStopTimeout(Duration.ofSeconds(5));
and here is the config:
akka.kafka.consumer {
max-retries = 5
check-interval=5000ms
stop-timeout = 1000ms
discovery-method = config
service-name = "ec2Kafka"
connection-checker {
enable = false
max-retries = 3
check-interval = 15s
backoff-factor = 2.0
}
}
discovery-consumer: ${akka.kafka.consumer} {
service-name = "ec2Kafka"
resolve-timeout = 100 ms
}
ec2Kafka = {
endpoints = [
{ host = "xxx.xxx.xxx.xxx", port = 9092 }
]
}
The code works perfectly in sample java main project. But when integrated with play 2.8.8, i get following warning:
<K,V>consumerBootstrapServers(com.typesafe.config.Config,akka.actor.ActorSystem) in akka.kafka.javadsl.DiscoverySupport has been deprecated
and in Play it throws error while creating the consumer.
Dependencies:
val AkkaVersion = "2.6.15";
val AlpakkaVersion = "2.0.1" ;
val AlpakkaKafkaVersion = "2.0.5" ;
......
"com.lightbend.akka" %% "akka-stream-alpakka-elasticsearch" % AlpakkaVersion,
"com.typesafe.akka" %% "akka-stream-kafka" % AlpakkaKafkaVersion,
"com.typesafe.akka" %% "akka-discovery" % AkkaVersion,
"com.typesafe.akka" %% "akka-stream" % AkkaVersion,
"com.typesafe.akka" %% "akka-actor-typed" % AkkaVersion,
"com.typesafe.akka" %% "akka-actor" % AkkaVersion,
My question:
- the same code and conf works in java main application without warnings and able to see the consumed messages.
- it does not work in play framework - addSbtPlugin(“com.typesafe.play” % “sbt-plugin” % “2.8.8”).
sbt version 1.5.2
Breaking my head for the past two days. Can someone throw some light ?
Thanks and Regards