diff --git a/modules/events-processor-core/src/main/kotlin/dev/adamko/kafkatorio/processor/config/ApplicationProperties.kt b/modules/events-processor-core/src/main/kotlin/dev/adamko/kafkatorio/processor/config/ApplicationProperties.kt index f55e2c6..8107790 100644 --- a/modules/events-processor-core/src/main/kotlin/dev/adamko/kafkatorio/processor/config/ApplicationProperties.kt +++ b/modules/events-processor-core/src/main/kotlin/dev/adamko/kafkatorio/processor/config/ApplicationProperties.kt @@ -35,7 +35,7 @@ data class ApplicationProperties( .addEnvironmentSource() .addResourceOrFileSource( resourceOrFile = "${System.getProperty("user.home")}/.secret.kafkatorio-config.yml", - optional = true + optional = true, ) .addResourceOrFileSource("/.secret.config.yml", optional = true) .addResourceOrFileSource("/config.yml", optional = false) diff --git a/modules/events-processor-core/src/main/kotlin/dev/adamko/kafkatorio/processor/core/topologyLauncher.kt b/modules/events-processor-core/src/main/kotlin/dev/adamko/kafkatorio/processor/core/topologyLauncher.kt index a597711..5ead349 100644 --- a/modules/events-processor-core/src/main/kotlin/dev/adamko/kafkatorio/processor/core/topologyLauncher.kt +++ b/modules/events-processor-core/src/main/kotlin/dev/adamko/kafkatorio/processor/core/topologyLauncher.kt @@ -4,7 +4,6 @@ import dev.adamko.kafkatorio.processor.config.ApplicationProperties import java.util.Properties import kotlin.coroutines.resume import kotlin.coroutines.resumeWithException -import kotlin.io.path.Path import kotlinx.coroutines.CoroutineName import kotlinx.coroutines.cancel import kotlinx.coroutines.coroutineScope @@ -18,7 +17,6 @@ import org.apache.kafka.streams.Topology import org.apache.kafka.streams.TopologyDescription - suspend fun launchTopology( id: String, topology: Topology, @@ -58,7 +56,7 @@ suspend fun launchTopology( streams.close() } - printTopologyDescription(appId, topology) + printTopologyDescription(appId, topology, appProps) streams.start() println("launched Topology $appId") } @@ -68,21 +66,27 @@ suspend fun launchTopology( } -private fun printTopologyDescription(appId: String, topology: Topology) { +private fun printTopologyDescription( + appId: String, + topology: Topology, + appProps: ApplicationProperties, +) { val description: TopologyDescription = topology.describe() - val descFile = Path("./build/$appId.txt").toFile().apply { - parentFile.mkdirs() - if (!exists()) createNewFile() - writeText(description.toString()) - } + val descFile = appProps.serverDataDir + .resolve("kafka-streams/$appId.txt") + .toFile().apply { + parentFile.mkdirs() + if (!exists()) createNewFile() + writeText(description.toString()) + } println( """ - |---------------- - |$appId - ${descFile.canonicalPath} - |$description - |---------------- - """.trimMargin() + |---------------- + |$appId - ${descFile.canonicalPath} + |$description + |---------------- + """.trimMargin() ) }