Coroutines
3 items
Series Posts
Part 0: Kotlin for Java Survivors: Life After Semicolons
A 16-part series for senior Java and Spring developers learning Kotlin 2.4. Follow Kabir, a 14-year Java veteran, from culture shock to shipping two Spring Boot 4.1 services with Kafka, Qdrant, Spring AI and LangChain4j.
Part 10: "Suspend Your Disbelief" — Coroutines Fundamentals
Cancelling an import leaves forty supplier calls running on virtual threads. We learn coroutines from the Java side: suspend functions and the state machine the compiler builds, launch/async/runBlocking, structured concurrency, coroutineScope vs supervisorScope, dispatchers and limitedParallelism, cooperative cancellation and timeouts, exception propagation, and how to debug it all.
Part 14: "Reactive and Events" — Coroutines, Streaming and Kafka
The AI team needs every product change, and Lena asks who owns the event schema. We publish a sealed, kotlinx.serialization event hierarchy to Kafka after commit and stream it as server-sent events from a Flow. We fan out to suppliers with suspend controllers and a suspending @HttpExchange client, and keep the request id in the logs as coroutines hop threads, all on Spring MVC with virtual threads.