Server-side Kotlin with Eclipse Vert.x at JavaOne
I was lucky enough to speak at JavaOne 2017 last month. It was my first time there, as both an attendee and a speaker.
I must say I was very much impressed. In particular, during the keynotes, I was happy to see how Java is moving forward, keeping up with the fast innovation pace in the cloud area.
Unleash Your Talents: Server-Side Kotlin for Mobile Developers
My presentation was about using the Kotlin language on the server-side with Eclipse Vert.x. They make a perfect match for the “fullstack mobile developer”.
Fullstack mobile developer
As more and more companies move to microservices architecture, mobile applications depend on different business services. Sometimes just a few, sometimes dozens. It then makes sense for them to build and run an edge service, or API Gateway.
The fullstack mobile developer will program both the frontend (device code) and the backend (edge service code) of a mobile application.
The case for Kotlin
Kotlin is a popular alternative language for Android applications. Mobile developers love it because it brings modern programming constructs yet allows for compatibility with a range of devices. Indeed, more than 80% of devices use a runtime version released in or before 2015.
But Kotlin is versatile and can be used on the server-side too.
Vert.x is a toolkit for building reactive applications. Its threading model is familiar to mobile developers: an event loop runs the code, but you offload blocking tasks to a worker pool. Besides, Vert.x does non-blocking I/O on the event loop. Consequently, it does not use server resources for slow clients on flaky networks. Yes, we have all been there with our smartphones…
In action: music catalog and streaming
A demo is worth a thousand slides, so I live coded part of a mobile backend for an Android music player. The code of the demo is available on GitHub. In the following video, you can see the HTTP server delivering a track catalog in JSON format and tracks streamed to the emulated mobile device (turn the sound on, it plays the tracks at the end!).
Download the Eclipse Vert.x cheat sheet, this cheat sheet provides step by step details to let you create your apps the way you want to.