Enterprise Java Microservices
Ken Finnigan
  • MEAP began April 2017
  • Publication in October 2018 (estimated)
  • ISBN 9781617294242
  • 293 pages (estimated)
  • printed in black & white

This example-rich tutorial shows how to design and manage large-scale Java applications as a collection of microservices. Starting with an overview of microservices from a Java EE perspective, you'll learn how to refactor your existing applications as microservices and build microservice-based applications from scratch. You'll power through practical tutorials as you call and connect microservices, understand what load balancing is, and use Netflix Hystrix for fault tolerance. You'll also master security and testing, as well as deploying to the cloud.

Table of Contents detailed table of contents

Part 1: Microservices Basics

1 Enterprise Java Microservices

1.1 Enterprise Java pitfalls

1.1.1 What is Enterprise Java?

1.1.2 Typical Enterprise Java Architecture

1.1.3 What is a Monolith?

1.1.4 Why Hate the Monolith?

1.2 Microservices and Distributed Architecture

1.2.1 Do One Thing Well

1.2.2 What is a Distributed Architecture?

1.2.3 Why should I care about being Distributed?

1.2.4 What can be done to assist in developing Microservices?

1.2.5 Product over Project

1.2.6 Continuous Integration and Delivery

1.3 Patterns for migration to microservices

1.3.1 Domain Driven Design

1.3.2 Big Bang Pattern

1.3.3 Strangler Pattern

1.3.4 Hybrid Pattern

1.4 What are Enterprise Java Microservices?

1.4.1 Why Enterprise Java is a good fit for Microservices

1.5 Summary

2 Developing a Simple RESTFul Microservice

2.1 Cayambe Monolith

2.2 New Administration Site

2.2.1 Use Cases

2.2.2 Architecture of the Application

2.2.3 Creating RESTFul endpoints with JAX-RS

2.2.4 Run it

2.3 Summary

3 Just enough Application Server for Microservices

3.1 Just enough Application Server

3.1.1 What does it mean?

3.1.2 What are the benefits?

3.1.3 Eclipse MicroProfile

3.2 Choosing Just enough Application Server

3.2.1 Beach Vacation example application

3.2.2 Dropwizard - The Original Opinionated Microservice runtime

3.2.3 Payara Micro - Slimmed Java EE App Server in a Jar

3.2.4 Spring Boot - Opinionated Spring Microservices

3.2.5 Thorntail - The Most Flexible JeAS Runtime

3.2.6 How do they compare?

3.3 Summary

4 Microservice Testing

4.1 What type of Testing do we need?

4.2 Unit Testing

4.3 Integration Testing

4.4 Consumer Driven Contract Testing

4.5 Additional Reading

4.6 Additional Exercises

4.7 Summary

5 Cloud Native Development

5.1 What is Cloud anyway?

5.1.1 Service Models

5.1.2 Cloud Native Development

5.2 Deploying to the Cloud

5.2.1 Starting Minishift

5.2.2 Microservice Cloud deployment

5.3 Testing in the Cloud

5.4 Additional Exercises

5.5 Summary

Part 2: Implementing Enterprise Java Microservices

6 Consuming Microservices

6.1 Consuming a Microservice with a Java Client Library

6.1.1 java.net

6.1.2 Apache HttpClient

6.2 Consuming a Microservice with a JAX-RS Client Library

6.2.1 JAX-RS Client

6.2.2 RESTEasy Client

6.3 Summary

7 Discovering Microservices for Consumption

7.1 Why does a Microservice need to be discovered?

7.1.1 What is Service Discovery?

7.1.2 What are the benefits of Service Discovery and a Registry?

7.1.3 Stateless vs Stateful Microservices

7.1.4 What is Netflix Ribbon?

7.2 Registering a Microservice with Thorntail

7.2.1 Thorntail’s Topologies

7.2.2 Registering a Microservice with a Topology

7.3 Consuming a Registered Microservice with Thorntail

7.3.1 Service Lookup with Netflix Ribbon

7.3.2 Service Lookup with RESTEasy Client

7.4 Summary

8 Strategies for Fault Tolerance and Monitoring

8.1 Microservice Failures in a Distributed Architecture

8.1.1 Network Failures

8.2 Mitigating Against Failures

8.2.1 What is Hystrix?

8.2.2 Circuit Breakers

8.2.3 Bulkheads

8.2.4 Fallbacks

8.2.5 Request Caching

8.2.6 Putting it all together

8.2.7 Hystrix Dashboard

8.3 Adding Hystrix to our Payment Microservice

8.3.1 Hystrix with RESTEasy Client

8.3.2 Hystrix with Ribbon Client

8.4 Summary

9 Securing a Microservice

9.1 Importance of Securing Microservice

9.1.1 Why is Security Important?

9.1.2 What does it need to solve?

9.1.3 What is Keycloak?

9.1.4 Setting up Keycloak

9.2 Securing Stripe Microservice

9.2.1 Configuring Keycloak

9.2.2 Securing the Stripe Resource

9.2.3 Authenticating in Payment Resource

9.2.4 Testing our Secured Microservice

9.3 Capturing User Authentication

9.3.1 Configuring Keycloak

9.3.2 Securing Category Deletion

9.3.3 Authenticating the User in a UI

9.3.4 Testing it all works

9.4 Summary

10 Architecting a Microservice Hybrid

10.1 The Cayambe "Monolith"

10.1.1 Running Cayambe "Monolith"

10.2 Cayambe Hybrid - "Monolith" with Microservices

10.2.1 Integrating Payment Microservice

10.2.2 Integrating Admin Microservice

10.2.3 New Administration UI

10.2.4 Cayambe Hybrid Summary

10.3 Deploying everything to a Hybrid Cloud

10.3.1 Database

10.3.2 Security

10.3.3 Microservices

10.3.4 Stripe Microservice

10.3.5 Payment Microservice

10.3.6 Cayambe Hybrid

10.3.7 Admin UI

10.4 Summary

11 Data Streaming with Apache Kafka

11.1 What can Apache Kafka do for me?

11.1.1 Data Streaming

11.1.2 Apache Kafka

11.2 Simplifying our "Monolith" architecture with streaming

11.3 Deploy and Utilize Kafka for Data Streaming

11.3.1 Kafka on OpenShift

11.3.2 Admin microservice

11.3.3 Kafka Consumer

11.4 Additional Exercises

11.5 Summary


Appendix A: A Spring Boot Microservices

A.1 Anatomy of a Spring Boot project

A.1.1 Examining a newly initialized Spring Boot project

A.2 Spring Boot Starter Dependencies

A.2.1 Using starter dependencies

A.3 Developing a Spring Boot Application

A.3.1 Focusing on application functionality

A.4 Spring Boot Testing

A.4.1 Mocking Spring MVC

A.5 Summary

About the Technology

Over time, enterprise-grade Java applications can become giant hulking beasts of intertwined code, bloated with third-party libraries, and vulnerable to total collapse when a single part fails. It doesn't have to be that way! Microservices break down a large application into smaller components, each interacting with each other to create a united whole. As each component can start, stop, and scale independently, so the whole system benefits from better fault-tolerance and resilience. Equally-important, separating the application into smaller independent services makes it substantially easier to efficiently manage the development and incremental improvement of your system.

What's inside

  • The microservices mental model
  • Fault tolerance with Netflix Hystrix
  • Securing your microservices
  • Deploying to the cloud

About the reader

This book is for Java developers familiar with distributed n-tier application architecture.

About the author

Ken Finnigan has worked as an engineer and consultant for nearly 20 years. He currently co-leads the development of WildFly Swarm for Red Hat.

Manning Early Access Program (MEAP) Read chapters as they are written, get the finished eBook as soon as it’s ready, and receive the pBook long before it's in bookstores.
Enterprise Java Microservices (combo) added to cart
continue shopping
go to cart

MEAP combo $49.99 pBook + eBook + liveBook
Enterprise Java Microservices (eBook) added to cart
continue shopping
go to cart

MEAP eBook $39.99 pdf + ePub + kindle + liveBook

FREE domestic shipping on three or more pBooks