[events-processors] change where topo description is written
This commit is contained in:
parent
657d5712f6
commit
ce0d4b7378
2 changed files with 19 additions and 15 deletions
|
|
@ -35,7 +35,7 @@ data class ApplicationProperties(
|
||||||
.addEnvironmentSource()
|
.addEnvironmentSource()
|
||||||
.addResourceOrFileSource(
|
.addResourceOrFileSource(
|
||||||
resourceOrFile = "${System.getProperty("user.home")}/.secret.kafkatorio-config.yml",
|
resourceOrFile = "${System.getProperty("user.home")}/.secret.kafkatorio-config.yml",
|
||||||
optional = true
|
optional = true,
|
||||||
)
|
)
|
||||||
.addResourceOrFileSource("/.secret.config.yml", optional = true)
|
.addResourceOrFileSource("/.secret.config.yml", optional = true)
|
||||||
.addResourceOrFileSource("/config.yml", optional = false)
|
.addResourceOrFileSource("/config.yml", optional = false)
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import dev.adamko.kafkatorio.processor.config.ApplicationProperties
|
||||||
import java.util.Properties
|
import java.util.Properties
|
||||||
import kotlin.coroutines.resume
|
import kotlin.coroutines.resume
|
||||||
import kotlin.coroutines.resumeWithException
|
import kotlin.coroutines.resumeWithException
|
||||||
import kotlin.io.path.Path
|
|
||||||
import kotlinx.coroutines.CoroutineName
|
import kotlinx.coroutines.CoroutineName
|
||||||
import kotlinx.coroutines.cancel
|
import kotlinx.coroutines.cancel
|
||||||
import kotlinx.coroutines.coroutineScope
|
import kotlinx.coroutines.coroutineScope
|
||||||
|
|
@ -18,7 +17,6 @@ import org.apache.kafka.streams.Topology
|
||||||
import org.apache.kafka.streams.TopologyDescription
|
import org.apache.kafka.streams.TopologyDescription
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
suspend fun launchTopology(
|
suspend fun launchTopology(
|
||||||
id: String,
|
id: String,
|
||||||
topology: Topology,
|
topology: Topology,
|
||||||
|
|
@ -58,7 +56,7 @@ suspend fun launchTopology(
|
||||||
streams.close()
|
streams.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
printTopologyDescription(appId, topology)
|
printTopologyDescription(appId, topology, appProps)
|
||||||
streams.start()
|
streams.start()
|
||||||
println("launched Topology $appId")
|
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 description: TopologyDescription = topology.describe()
|
||||||
|
|
||||||
val descFile = Path("./build/$appId.txt").toFile().apply {
|
val descFile = appProps.serverDataDir
|
||||||
parentFile.mkdirs()
|
.resolve("kafka-streams/$appId.txt")
|
||||||
if (!exists()) createNewFile()
|
.toFile().apply {
|
||||||
writeText(description.toString())
|
parentFile.mkdirs()
|
||||||
}
|
if (!exists()) createNewFile()
|
||||||
|
writeText(description.toString())
|
||||||
|
}
|
||||||
|
|
||||||
println(
|
println(
|
||||||
"""
|
"""
|
||||||
|----------------
|
|----------------
|
||||||
|$appId - ${descFile.canonicalPath}
|
|$appId - ${descFile.canonicalPath}
|
||||||
|$description
|
|$description
|
||||||
|----------------
|
|----------------
|
||||||
""".trimMargin()
|
""".trimMargin()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue