Building Scalable Microservices with Ktor and Kafka
During the workshop, we received an introduction to the Ktor services framework. Ktor is a framework built from the ground up using Kotlin and Coroutines and thereby an alternative to Spring or Spring Boot – frameworks many developers are familiar with. It is lightweight and designed for building connected systems, enabling us to delve into the basics by creating a simple web application using essential functions. For a more detailed comparison of Ktor with other JVM backend frameworks, check out this article by my colleague Fabian. Topics covered included handling HTTP requests, working with WebSockets, database access, authentication and authorization, logging, and more. We also explored Ktor’s plugin API, wrote a simple plugin for our web application to gain insight into the framework’s extensibility and versatility.
Once we were comfortable with Ktor, the workshop shifted focus to modeling a distributed system with asynchronous communication between different systems. The supposed key requirements for such a system are messaging, real-time stream processing and long-term storage. To address these needs, Apache Kafka was introduced.
Apache Kafka, a distributed event streaming platform, is designed to make systems truly asynchronous, distributed, and resilient. During the workshop, we learned how to integrate Kafka into our Ktor-based applications, experiencing first-hand the powerful synergy between these technologies.
Anton Arhipov’s insights into Ktor, Kotlin, and JetBrains provided a valuable foundation for understanding how these technologies work together to create powerful, scalable microservices. Viktor Gamov’s expertise in Kafka added a unique dimension to the workshop, showcasing the benefits of integrating these tools and technologies.
Conference Talks: Highlights and Takeaways
Writing Backend APIs in a Functional Programming Style
This talk covered a pattern for writing backend APIs in a functional programming style, focusing on separating business logic from I/O. The speaker showcased how Kotlin’s structured concurrency features make it easier to decouple I/O and business logic, leading to robust error handling and adaptability to easily implement new or changing product requirements. The talk resonated with me because my current project faced similar issues, and our solutions aligned closely with those presented.
Reflections on a Year of Compose
The Reflections on a Year of Compose talk offered an interesting insight into Pinterest’s development team’s journey as they explored Compose integration in late 2021. The speaker shared the team’s learnings, including the decision not to fully adopt Compose at this time. While not the success story they had anticipated, the retrospective highlighted the valuable lessons learned when things don’t go according to plan.
Coroutines and Loom behind the Scenes
This talk compared the goals, implementations, and tradeoffs of Kotlin Coroutines and Project Loom, an OpenJDK project in preview. The speaker discussed which applications would benefit most from each technology, how they will coexist in the future, and where developers can leverage both for optimal results.
How We’re Improving Performance of IntelliJ IDEA Kotlin Plugin
The speaker, an engineer in IntelliJ Kotlin plugin team, shared the challenges and successes in improving the performance of the Kotlin plugin for IntelliJ IDEA. The talk delved into the technical details of how the IDE works, including features such as Find usages and code highlighting. The discussion also covered why the IDE might freeze occasionally and the complexities of supporting Kotlin/Java interoperability. The presentation revealed the next big initiative, the Kotlin plugin that uses the K2 compiler, and how it should significantly improve the performance of many IDE features.
KotlinConf 2023 was an unforgettable experience, filled with insightful workshops and talks that showcased the future of Kotlin development. The deep dive into Ktor and Kafka, alongside the exploration of functional programming, Compose integration, and development tool improvements, left attendees eager to experiment with new ideas and techniques in the Kotlin ecosystem. As Kotlin’s popularity continues to rise, it’s clear that this versatile language will play a significant role in shaping the future of software development.
The keynote and several conversations with speakers can be viewed on Kotlin’s YouTube channel.