Enterprise Java Microservices
Ken Finnigan
  • MEAP began April 2017
  • Publication in Summer 2018 (estimated)
  • ISBN 9781617294242
  • 350 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: Getting Started

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. Introducing the Simple Microservice

2.1.1. Address Management application

2.1.2. Application Use Cases

2.1.3. Architecture of the Application

2.2. Creating RESTFul endpoints with JAX-RS

2.2.1. View all addresses

2.2.2. Delete an address

2.2.3. Add an address

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. 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. WildFly Swarm - The Most Flexible JeAS Runtime

3.2.6. How do they compare?

3.3. Summary

Part 2: Microservices with Enterprise Java

4. Consuming Microservices

4.1. Consuming a Microservice with a Java Client Library

4.1.1. java.net

4.1.2. Apache HttpClient

4.2. Consuming a Microservice with a JAX-RS Client Library

4.2.1. JAX-RS Client

4.2.2. RESTEasy Client

4.3. Consuming a Microservice with WildFly Swarm

4.3.1. Simplified Client usage

4.4. Summary

5. Discovering Microservices for Consumption

5.1. Why does a Microservice need to be discovered?

5.1.1. What is Service Discovery?

5.1.2. What are the benefits of Service Discovery and a Registry?

5.1.3. Stateless vs Stateful Microservices

5.1.4. What is Netflix Ribbon?

5.2. Registering a Microservice with WildFly Swarm

5.2.1. WildFly Swarm’s Topologies

5.2.2. Registering a Microservice with a Topology

5.3. Consuming a Registered Microservice with WildFly Swarm

5.3.1. Service Lookup with Netflix Ribbon

5.3.2. Service Lookup with RESTEasy Client

5.3.3. Scaling Microservices with our Example

5.4. Summary

6. Strategies for Fault Tolerance and Monitoring

6.1. Microservice Failures in a Distributed Architecture

6.1.1. Network Failures

6.2. Mitigating Against Failures

6.2.1. What is Hystrix?

6.2.2. Circuit Breakers

6.2.3. Bulkheads

6.2.4. Fallbacks

6.2.5. Request Caching

6.2.6. Putting it all together

6.2.7. Hystrix Dashboard

6.3. Adding Hystrix to our Message Microservice

6.3.1. Hystrix with RESTEasy Client

6.3.2. Hystrix with Ribbon Client

6.4. Summary

7. Securing a Microservice

7.1. Importance of Securing Microservice

7.1.1. Why is Security Important?

7.1.2. What does it need to solve?

7.1.3. What is Keycloak?

7.1.4. Setting up Keycloak

7.2. Securing Time Microservice

7.2.1. Configuring Keycloak

7.2.2. Securing the Time Resource

7.2.3. Authenticating in Message Resource

7.2.4. Testing our Secured Microservice

7.3. Capturing User Authentication

7.3.1. Configuring Keycloak

7.3.2. Securing Address Deletion

7.3.3. Authenticating the User in a UI

7.3.4. Testing it all works

7.4. Summary

8. Microservice Testing

8.1. What type of Testing do we need?

8.2. Unit Testing

8.3. Integration Testing

8.4. Consumer Driven Contract Testing

8.5. Additional Reading

8.6. Additional Exercises

8.7. Summary

9. Cloud Native Development

Part 3: Extending a “Monolith” with Microservices

10. Architecting a Microservice Hybrid

11. Data Streaming with Kafka

12. Spring Boot Microservices and Java EE

13. Reactive Microservices and Java EE

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.
MEAP combo $49.99 pBook + eBook + liveBook
MEAP eBook $39.99 pdf + ePub + kindle + liveBook

FREE domestic shipping on three or more pBooks