https://kotlinlang.org logo
#getting-started
Title
# getting-started
a

Adam S

07/10/2022, 6:47 AM
tl;dr: Is there ordered queue with file-based storage for coroutines? I've got a Ktor socket server that captures log messages from a TCP port, and forwards them to a Kafka topic. However the connection to Kafka is unstable, so I need to store the logs locally, and then forward them to Kafka once the connection is up. I think the best solution is a local file-based ordered store that I can put messages into with a
MutableSharedFlow<String>
, and then another
SharedFlow<String>
that in another coroutine awaits new messages from the file-store and forwards them to the Kafka topic (I'm using Kotlin/JVM 1.7, Ktor 2.0, Kakfa 3.2)
2 Views