File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed
starters/spring/stove-spring-testing-e2e-kafka/src/main/kotlin/com/trendyol/stove/testing/e2e/kafka Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,6 @@ projectUrl=https://github.com/Trendyol/stove
99licenceUrl =https://github.com/Trendyol/stove/blob/master/LICENCE
1010licence =Apache-2.0 license
1111snapshot =1.0.0-SNAPSHOT
12- version =0.14.0
12+ version =0.14.1
1313
1414
Original file line number Diff line number Diff line change @@ -53,15 +53,27 @@ class KafkaSystem(
5353 it.setProducerListener(getInterceptor())
5454 it.setCloseTimeout(1 .seconds.toJavaDuration())
5555 }
56- .firstOrNone {
57- it.producerFactory.configurationProperties[ProducerConfig .BOOTSTRAP_SERVERS_CONFIG ] == exposedConfiguration.bootstrapServers
58- }
56+ .firstOrNone { safeContains(it, exposedConfiguration) }
5957 .getOrElse {
6058 logger.warn(" No KafkaTemplate found for the configured bootstrap servers, using a fallback KafkaTemplate" )
6159 createFallbackTemplate(exposedConfiguration)
6260 }
6361 }
6462
63+ @Suppress(" UNCHECKED_CAST" )
64+ private fun safeContains (
65+ it : KafkaTemplate <Any , Any >,
66+ exposedConfiguration : KafkaExposedConfiguration
67+ ): Boolean = it.producerFactory.configurationProperties[ProducerConfig .BOOTSTRAP_SERVERS_CONFIG ]
68+ .toOption()
69+ .map {
70+ when (it) {
71+ is String -> it
72+ is List <* > -> (it as List <String >).joinToString(" ," )
73+ else -> " "
74+ }
75+ }.isSome { it.contains(exposedConfiguration.bootstrapServers) }
76+
6577 private fun createFallbackTemplate (exposedConfiguration : KafkaExposedConfiguration ): KafkaTemplate <Any , Any > {
6678 val producerFactory = DefaultKafkaProducerFactory <Any , Any >(
6779 mapOf (
You can’t perform that action at this time.
0 commit comments