About this book

Over the last seven or eight years, the term microservices has exploded in its use, not always to the betterment of developers trying to understand what it means. During the latter part of that time, developers have sought to bring their existing Enterprise Java knowledge to microservices, not always with the best of success. Enterprise Java Microservices is written with the goal of helping existing Enterprise Java developers bridge the gap between traditional application development and microservices.

As part of my job at Red Hat, I’ve seen the explosion of microservices first hand. That explosion was a contributing factor in a colleague and me forming the WildFly Swarm project in 2015. We saw the need for developers with existing Enterprise Java knowledge to create microservices, and with nothing focused on the Java EE space at the time, we created WildFly Swarm. Much has changed since then, and the current landscape for microservices makes it seem like a lifetime has passed.

Since I began writing this book, changes have continued to occur rapidly with Enterprise Java—in particular, the Thorntail project that I lead, and with microservices more generally. As best as I can, I’ve endeavored to update the book as those changes occurred.

It should be noted that this book isn’t intended to delve deeply into all aspects of microservice development; it would be many times longer than it is now if that were the case. Where appropriate, links to additional reading are provided if you choose to delve into a particular topic in greater detail.

Who should read this book

This book is for any Enterprise Java developer with at least four years of experience. These developers may have basic knowledge of microservices and may even have tried microservices with Node.js or other non-Enterprise Java technologies, but haven’t learned to develop Enterprise Java microservices.

How this book is organized: a roadmap

The book is split into two parts. Part 1, chapters 1 through 5, discusses the overall architecture of microservice and distributed systems, along with the concept of slimming application servers, testing, and cloud native development. Part 2 delves into the nitty gritty of microservice development such as service registries, fault tolerance, and security.

Chapter 1 introduces the reader to Enterprise Java—in particular, what a monolith is and how it came about. Then the chapter introduces distributed architectures and microservices by covering what they are, what the term means, and other processes that go hand in hand with the switch to microservices. Lastly, it introduces patterns that can be applied to migrating from monoliths to microservices, and when each might apply.

Chapter 2 introduces a microservice by developing RESTful endpoints for managing a list of categories for a shopping site. The chapter also introduces the Cayambe monolith, which will be converted to a hybrid and have additional microservices developed for it throughout the book.

Chapter 3 introduces the concept of a Just enough Application Server (JeAS) runtime and showcases the differences between the frameworks available to support such a runtime.

Chapter 4 covers how unit and integration testing differ now that we’re developing microservices, and the tools available to make testing easier. The chapter also introduces a new concept of consumer-driven contract testing, which is critical to success in architectures with many microservices collaborating and communicating.

Chapter 5 talks about the cloud and the different service models used in different cloud environments. We also discuss cloud native development and how that fits into the microservices world. Next, we use tools at our disposal for local cloud development, and you’ll see how these tools can be used for testing.

Chapter 6 discusses the libraries available for consuming external microservices, and the levels of abstraction they provide. We cover fairly low-level libraries like java.net and Apache HttpClient before investigating libraries with a higher level of abstraction such as JAX-RS and RESTEasy clients.

Chapter 7 extends chapter 6 by adding the necessary pieces for our microservices to be able to discover what they wish to consume. Without being able to register a microservice, or discover it, there’s no way to reliably consume one.

Chapter 8 dives into a critical topic for distributed architectures and microservices—failure and how to mitigate against it. We briefly cover the typical types of failure we can encounter with microservices, before covering how the various parts of the Hystrix framework enable us to provide a means for our microservice to account for failures that might arise.

Chapter 9 discusses security for our microservices and how to achieve it with Keycloak. From what is required to secure microservices, to retrieving tokens within a microservice for calling secured microservices, and, lastly, authenticating a user within a UI for consuming secured microservices, this chapter covers it all.

Chapter 10 revisits the Cayambe monolith by showing how it can be run in its unmodified form. You’ll then be taken through the steps to switch Cayambe to be a hybrid that has monolithic parts, but that also consumes microservices to expand and distribute its functionality.

Chapter 11 introduces the topic of data streaming with Apache Kafka by reducing the duplication of data between hybrids and microservices. You’ll use data streaming to enable real-time updates to disparate data to simplify distributed architectures.

About the code

All the code from the book can be found in the source code files that accompany the book. The source code can be downloaded free of charge from the Manning website (www.manning.com/books/enterprise-java-microservices), as well as via the following GitHub repository: https://github.com/kenfinnigan/ejm-samples. All the sample code is structured as a series of Maven modules for each chapter or part of a chapter.

All source code in listings or in the text is in a fixed width font like this to separate it from ordinary text. In many listings, the code is annotated to point out key concepts.

Book forum

Purchase of Enterprise Java Microservices includes free access to a private web forum run by Manning Publications, where you can make comments about the book, ask technical questions, and receive help from the author and from other users. To access the forum, go to https://forums.manning.com/forums/java-microservices-in-action. You can also learn more about Manning’s forums and the rules of conduct at https://forums.manning.com/forums/about.

Manning’s commitment to our readers is to provide a venue where a meaningful dialogue between individual readers and between readers and the author can take place. It isn’t a commitment to any specific amount of participation on the part of the author, whose contribution to the forum remains voluntary (and unpaid). We suggest you try asking the author some challenging questions lest his interest stray! The forum and the archives of previous discussions will be accessible from the publisher’s website as long as the book is in print.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.22.41.235