Skip to content

Commit

Permalink
Justere ned antall records en kan polle og intervallet mellom hvert p…
Browse files Browse the repository at this point in the history
…oll tilsvarende (tok tallene fra rapid&rivers )
  • Loading branch information
geiralund committed Dec 29, 2021
1 parent c073dde commit 7857ff5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/kotlin/no/nav/dagpenger/streams/StreamConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import com.natpryce.konfig.stringType
import mu.KotlinLogging
import org.apache.kafka.clients.CommonClientConfigs
import org.apache.kafka.clients.consumer.ConsumerConfig
import org.apache.kafka.clients.consumer.ConsumerConfig.MAX_POLL_RECORDS_CONFIG
import org.apache.kafka.clients.producer.ProducerConfig
import org.apache.kafka.common.config.SaslConfigs
import org.apache.kafka.common.config.SslConfigs
Expand All @@ -17,10 +18,14 @@ import org.apache.kafka.streams.StreamsConfig.AT_LEAST_ONCE
import org.apache.kafka.streams.errors.LogAndFailExceptionHandler
import java.io.File
import java.lang.System.getenv
import java.time.Duration
import java.util.Properties

private val LOGGER = KotlinLogging.logger {}

private val maxPollRecords = 50
private val maxPollIntervalMs = Duration.ofSeconds(60 + maxPollRecords * 2.toLong()).toMillis()

fun streamConfig(
appId: String,
bootStapServerUrl: String,
Expand Down Expand Up @@ -99,6 +104,8 @@ private fun commonProperties(
) = listOf(
CommonClientConfigs.RETRY_BACKOFF_MS_CONFIG to 1000,
CommonClientConfigs.RECONNECT_BACKOFF_MS_CONFIG to 5000,
CommonClientConfigs.MAX_POLL_INTERVAL_MS_CONFIG to "$maxPollIntervalMs",
StreamsConfig.consumerPrefix(MAX_POLL_RECORDS_CONFIG) to maxPollRecords,
StreamsConfig.BOOTSTRAP_SERVERS_CONFIG to bootStapServerUrl,
StreamsConfig.APPLICATION_ID_CONFIG to appId,

Expand Down

0 comments on commit 7857ff5

Please sign in to comment.