Skip to content

Commit

Permalink
Ytelse justering
Browse files Browse the repository at this point in the history
  • Loading branch information
OleksandrChmyrNAV committed Dec 4, 2024
1 parent 9e79ad6 commit 39bba0d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions ebms-provider/src/main/kotlin/no/nav/emottak/ebms/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ fun Application.ebmsProviderModule() {
if (records.count() > 0) {
log.debug("Kafka test: Last message - ${records.toList().last().value()}")
}
consumer.close()
} catch (e: Exception) {
log.error("Kafka test: Exception while reading messages from queue", e)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,27 @@ class KafkaClient {
put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, kafkaBrokers)
put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer::class.java.name)
put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer::class.java.name)
put(ProducerConfig.BUFFER_MEMORY_CONFIG, "16777216")
put(ProducerConfig.BATCH_SIZE_CONFIG, "8192")
put(ProducerConfig.RETRIES_CONFIG, "3")
put(ProducerConfig.REQUEST_TIMEOUT_MS_CONFIG, "30000")
}
return KafkaProducer(props)
}

fun createConsumer(): KafkaConsumer<String, String> {
val props = Properties().apply {
put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, kafkaBrokers)
put(ConsumerConfig.GROUP_ID_CONFIG, "ebms-provider")
put(ConsumerConfig.GROUP_ID_CONFIG, "ebms-provider10")
put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer::class.java.name)
put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer::class.java.name)
put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest")
// put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, "false")
put(ConsumerConfig.MAX_POLL_RECORDS_CONFIG, "1") // TODO: it is debug setting
put(ConsumerConfig.MAX_POLL_RECORDS_CONFIG, "10")
put(ProducerConfig.BUFFER_MEMORY_CONFIG, "16777216")
put(ProducerConfig.BATCH_SIZE_CONFIG, "8192")
put(ProducerConfig.RETRIES_CONFIG, "3")
put(ProducerConfig.REQUEST_TIMEOUT_MS_CONFIG, "30000")
}
return KafkaConsumer(props)
}
Expand Down

0 comments on commit 39bba0d

Please sign in to comment.