Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Hands-On Microservices with  Kotlin
  • Table Of Contents Toc
  • Feedback & Rating feedback
Hands-On Microservices with  Kotlin

Hands-On Microservices with Kotlin

By : Medina Iglesias
4.4 (8)
close
close
Hands-On Microservices with  Kotlin

Hands-On Microservices with Kotlin

4.4 (8)
By: Medina Iglesias

Overview of this book

With Google's inclusion of first-class support for Kotlin in their Android ecosystem, Kotlin's future as a mainstream language is assured. Microservices help design scalable, easy-to-maintain web applications; Kotlin allows us to take advantage of modern idioms to simplify our development and create high-quality services. With 100% interoperability with the JVM, Kotlin makes working with existing Java code easier. Well-known Java systems such as Spring, Jackson, and Reactor have included Kotlin modules to exploit its language features. This book guides the reader in designing and implementing services, and producing production-ready, testable, lean code that's shorter and simpler than a traditional Java implementation. Reap the benefits of using the reactive paradigm and take advantage of non-blocking techniques to take your services to the next level in terms of industry standards. You will consume NoSQL databases reactively to allow you to create high-throughput microservices. Create cloud-native microservices that can run on a wide range of cloud providers, and monitor them. You will create Docker containers for your microservices and scale them. Finally, you will deploy your microservices in OpenShift Online.
Table of Contents (20 chapters)
close
close
Title Page
Copyright and Credits
Dedication
Packt Upsell
Contributors
Preface
chevron up
Index

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

If you are a Kotlin developer with a basic knowledge of microservice architectures and now want to effectively implement these services on enterprise-level web applications, then this book is for you.

What this book covers

Chapter 1, Understanding Microservices, introduces microservices and their principles. We will review Domain-Driven Design, Cloud-Native microservices, and Reactive architecture.

Chapter 2, Getting Started with Spring Boot 2.0, helps develop our first microservice with Kotlin using Spring Boot 2.0. We will take a deep dive into the Spring Boot and see how we can use IntelliJ IDEA to build our microservices.

Chapter 3, Creating RESTful Services, expands our Cloud-Native microservices to become RESTful APIs, introducing different Spring components.

Chapter 4, Creating Reactive Microservices, creates non-blocking reactive microservices. We will learn how we can use Spring WebFlux and project Reactor to build reactive microservices.

Chapter 5, Reactive Spring Data, focuses on how we can use reactive Spring Data to perform operations against NoSQL databases such as MongoDB. Then, it looks at how we can enhance our reactive microservices creating reactive CRUD operations for our REST APIs.

Chapter 6, Creating Cloud-Native Microservices, outlines what Cloud-Native microservices are, and how we can easily build with Spring Cloud.

Chapter 7, Creating Dockers, informs how to install and configure Docker to create, publish, and run containers, and how we can integrate this when we build our microservices with Maven.

Chapter 8, Scaling Microservices, showcases how we can Docker swarm to create our own personal cloud, and how we can scale and control our microservices.

Chapter 9, Testing Spring Microservices, covers how we can test our microservices using JUnit using SpringBootTest. We will learn how we can test our microservice in a more expressive way by using Kluent to do fluent tests.

Chapter 10, Monitoring Microservices, discusses why monitoring is a critical part of any production-ready system, and how we can provide microservices that can be monitored and controlled using Spring Boot Actuator and JMX.

Chapter 11, Deploying Microservices, explains how to deploy our microservices Dockers in OpenShift Online, and how we can integrate GitHub to do automatic deployments when our microservices code changes.

Chapter 12, Best Practices, goes through industry best practices that we can use to create our microservices.

To get the most out of this book

To get up and running, users will need to have the following software installed:

  • JDK 8
  • Maven 3.5+
  • IntelliJ IDEA CE 2017.3
  • Any Zip Extractor
  • Any Browser
  • Docker for Windows or Docker for Mac (Not Docker toolbox)
  • For some examples related to Windows, you may need Cygwin or Windows Linux Subsystem

Download the example code files

You can download the example code files for this book from your account at www.packtpub.com. If you purchased this book elsewhere, you can visit www.packtpub.com/support and register to have the files emailed directly to you.

You can download the code files by following these steps:

  1. Log in or register at www.packtpub.com
  2. Select the SUPPORT tab
  3. Click on Code Downloads & Errata
  4. Enter the name of the book in the Search box and follow the onscreen instructions

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR/7-Zip for Windows
  • Zipeg/iZip/UnRarX for Mac
  • 7-Zip/PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Hands-On-Microservices-with-Kotlin.

Note

When this book was written, the current snapshot version of Spring Boot 2 was Spring Boot 2.0.0 M7. The code bundle and examples are up to date with that version. Eventually, Spring Boot 2.0.0 will be finally released and the code bundle will be updated accordingly.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Download the color images

We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here: https://www.packtpub.com/sites/default/files/downloads/HandsOnMicroserviceswithKotlin_ColorImages.pdf.

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in the text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "Mount the downloaded WebStorm-10*.dmg disk image file as another disk in your system."

A block of code is set as follows:

package com.microservices.chapter2

interface ServiceInterface {
  fun getHello(name : String) : String
}

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

<build>
....
 <plugins>
  <plugin>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-maven-plugin</artifactId>
   <configuration>
    <executable>true</executable>
   </configuration>
  </plugin>
....
</build>

Any command-line input or output is written as follows:

mvnwspring-boot:run
mvnw compile

Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "Select System info from the Administration panel."

Note

Warnings or important notes appear like this.

Note

Tips and tricks appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: Email [email protected] and mention the book title in the subject of your message. If you have questions about any aspect of this book, please email us at [email protected].

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.

Piracy: If you come across any illegal copies of our works in any form on the Internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.

Reviews

Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!

For more information about Packt, please visit packtpub.com.

Limited Time Offer

$10p/m for 3 months

Get online access to our library of over 7000 practical eBooks and videos, constantly updated with the latest in tech and supported with AI assistants
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist download Download options font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon

Create a Note

Modal Close icon
You need to login to use this feature.

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Delete Note

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Edit Note

Modal Close icon
Write a note (max 255 characters)
Cancel
Update Note