Hands-On Microservices with Kotlin
Build reactive and cloud-native microservices with Kotlin using Spring 5 and Spring Boot 2.0
Juan Antonio Medina Iglesias
BIRMINGHAM - MUMBAI
Hands-On Microservices with Kotlin
Copyright 2018 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author nor Packt Publishing or its dealers and distributors will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
Commissioning Editor: Kunal Chaudhari
Acquisition Editor: Nigel Fernandes
Content Development Editor: Francis Carneiro
Technical Editor: Diksha Wakode
Copy Editor: Safis Editing
Project Coordinator: Devanshi Doshi
Proofreader: Safis Editing
Indexers: Tejal Daruwale Soni
Graphics: Jason Monteiro
Production Coordinator: Aparna Bhagat
First Edition: January 2018
Production reference: 1240118
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-78847-145-9
www.packtpub.com
To my friend Juan Antonio Brea; his motivation and passion is an example, pushing me to a level that I thought was not possible. Without him, this book would never exist. To Sergio Valera, whose inspiration and vision will be something that I'll always remember, no matter how far apart we are nowadays.
Juan Antonio Medina Iglesias
mapt.io
Mapt is an online digital library that gives you full access to over 5,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website.
Why subscribe?
Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals
Improve your learning with Skill Plans built especially for you
Get a free eBook or video every month
Mapt is fully searchable
Copy and paste, print, and bookmark content
PacktPub.com
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at service@packtpub.com for more details.
At www.PacktPub.com , you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks.
Contributors
About the author
Juan Antonio Medina Iglesias began his career 20 years ago as an indie game developer and worked abroad four countries since then, from embedded software to enterprise applications. He has a lifetime's dedication to software craftsmanship.
Since 2006, he works at Santander Technology with a talented group of professionals who performed one of the biggest transformations in the banking industry.
Nowadays, he works as a Senior Engineer in the Digital Transformation team within Santander Technology UK.
I need to thank Victor Herraiz and Neil Cannon my official reviewers and to Francis Carneiro my Content Developer Editor. They have done a great work with the content of the book and the example code.
I must as well thank, David Albone, Rachel Warburton, Alan Taylor and Khurram Mahmood for the unofficial reviews and feedback on the chapters.
About the reviewers
Neil Cannon has been developing Android applications since 2010, following many years working on server-side Java. After trying the Kotlin 1.0 beta, he moved away from Java and has written as little Java as possible since.
Vctor Herraiz Posada is a senior software engineer with more than 15 years of experience in designing and developing complex distributed systems for companies such as Santander Group and Mapfre.
He is passionate about teaching and training. He has given courses and talks on accessibility, quality control, design patterns, and programming languages. He loves physics, metal music, playing guitar, video games and old sci-fi movies, books, and comics.
I would like to thank Juan Antonio Medina Iglesias for asking me to review this insightful book. Microservices with Kotlin is quite a journey through the challenges that many companies have to face.
Packt is searching for authors like you
If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea.
Table of Contents
Preface
With Google's announcement of introducing first-class support for Kotlin in their Android ecosystem, Kotlin is realized as a mainstream language.
Microservices helps with designing scalable, easy-to-maintain web applications, and Kotlin allows us to take advantage of modern idioms to simplify our development and create high-quality services.
With 100% of interoperability with the JVM, Kotlin makes it easy to work with the existing Java code.
Popular Java frameworks, such as Spring, Jackson, and Reactor, have included Kotlin modules to take advantage of language features such as null safety and type-safe declarative builders.
This book will guide the reader through designing and implementing services to having the production-ready testable code, creating easy-to-maintain and lean code that will be shorter and simpler than a traditional Java implementation.
We will discover the benefits of using the reactive paradigm in order to take advantage of non-blocking techniques and take our services to the next level of industry standards.
During the journey, we'll consume NoSQL databases reactively in order to create high- throughput microservices.
In this book, we will demonstrate how we can create Cloud-Native microservices that can run in a wide range of cloud providers, and how we can monitor them.
We will create Docker containers for our microservices and learn how to scale them.
Finally, we will deploy our microservices in Openshift Online.
Who this book is for