Scala Microservices
Develop, deploy, and run microservices with Scala
Jatin Puri
Selvam Palanimalai
BIRMINGHAM - MUMBAI
Scala Microservices
Copyright 2017 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 authors, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be 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.
First published: September 2017
Production reference: 1150917
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-78646-934-2
www.packtpub.com
Credits
Authors Jatin Puri Selvam Palanimalai | Copy Editor Safis Editing |
Reviewer Mark Elston | Project Coordinator Prajakta Naik |
Commissioning Editor Kunal Parikh | Proofreader Safis Editing |
Acquisition Editor Chaitanya Nair | Indexer Francy Puthiry |
ContentDevelopmentEditor Siddhi Chavan | Graphics Abhinash Sahu |
Technical Editor Supriya Thabe | Production Coordinator Nilesh Mohite |
About the Authors
Jatin Puri is a passionate engineer and programming language enthusiast. He holds a master's degree in mathematics. He is a Lightbend-certified Scala trainer and is involved with spreading goodness of Scala through Hyderabad Scala Meetup, Stack Overflow, training workshops, and open source contributions.
When he is not programming, he teaches meditation and stress elimination techniques under the aegis of The Art of Living foundation.
To my family who mean the world to me. And to my guru, His Holiness Sri Sri Ravi Shankar Ji, who made the world my family.
The authors are grateful to some lovely people who were instrumental with different aspects of the book: Sri Sunil Vyas Ji for making it happen; Rajmahendra Hegde for the original idea; Nabarun Mondal and Lekha Sachdev for the metaphors; Aayush Surana, Mohit Mandokhot, Niraj Patel, Danish Puri, Mannat Vij, Kshtregya Vij, Aarushi Vij, Shravya Vij, Agam Dhall, Samidha Dhall, Nityesh Sachdev, Prakhar Srivastav, and Deepak Agrawal for the proofreads.
Selvam Palanimalai is a Production Engineer currently working in data pipeline automation using Kubernetes and Spark in downtown Toronto. He is passionate about technology-driven problem solving, clean data, and merciless automation. He is active in the open source community on GitHub, contributing to the Statistical group (SOCR) at the University of Michigan, Ann Arbor.
I would like to thank my Dad for all the inspiration and motivation in life. And my co-author, Jatin, for his energy and guidance in writing this book. This book wouldn't have been possible without the valuable feedback of Nehil Jain, Keshav Raghu and Mark Elston
About the Reviewer
Mark Elston has been a software developer for 30+ years and has developed software in a wide number of fields, including Systems Simulation, Embedded Hardware Control Systems, Desktop Applications, and Tester Operating Systems for Semiconductor Test systems. He has been with Advantest America for 20+ years as a software engineer and a software architect.
Advantest, his current employer, produces a wide variety of test equipment for the semiconductor industry.
He has also reviewed the book Mastering Android Wear Application Development by Packt.
www.PacktPub.com
For support files and downloads related to your book, please visit www.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.
https://www.packtpub.com/mapt
Get the most in-demand software skills with Mapt. Mapt gives you full access to all Packt books and video courses, as well as industry-leading tools to help you plan your personal development and advance your career.
Why subscribe?
- Fully searchable across every book published by Packt
- Copy and paste, print, and bookmark content
- On demand and accessible via a web browser
Customer Feedback
Thanks for purchasing this Packt book. At Packt, quality is at the heart of our editorial process. To help us improve, please leave us an honest review on this book's Amazon page at https://www.amazon.com/dp/ 1786469340 .
If you'd like to join our team of regular reviewers, you can e-mail us at customerreviews@packtpub.com. We award our regular reviewers with free eBooks and videos in exchange for their valuable feedback. Help us be relentless in improving our products!
Table of Contents
Preface
Microservices is an architectural style and pattern that is becoming very popular and adopted by many organizations because of the advantages that it offers. In this book, you will learn what it takes to build great applications using microservices, the pitfalls associated with such a design, and the techniques to avoid them.
We will start by shedding light on traditional monoliths, and the problems faced in such architectures and how microservices are an obvious evolution to tackle such problems. We will then learn to build performant web-services using Play Framework. You will understand the importance of writing code that is asynchronous and non-blocking and how Play leverages this paradigm internally for a higher throughput.
Next, you will learn about the Reactive Manifesto and understand its practical benefits by leveraging it in your design. We will introduce the Lagom Framework, which serves two purposes: building reactive applications that are scalable and resilient to failures, and solving the problems associated with microservices architecture, such as service gateway, service discovery, inter-microservice communication and streaming, and so on. Message passing is used as a means to achieve resilience, and CQRS with Event Sourcing helps us model data for highly interactive applications.