O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Microservices Best Practices for Java

Book Description

Microservices is an architectural style in which large, complex software applications are composed of one or more smaller services. Each of these microservices focuses on completing one task that represents a small business capability. These microservices can be developed in any programming language.

This IBM® Redbooks® publication covers Microservices best practices for Java. It focuses on creating cloud native applications using the latest version of IBM WebSphere® Application Server Liberty, IBM Bluemix® and other Open Source Frameworks in the Microservices ecosystem to highlight Microservices best practices for Java.

Table of Contents

  1. Front cover
  2. Notices
    1. Trademarks
  3. Preface
    1. Authors
    2. Now you can become a published author, too!
    3. Comments welcome
    4. Stay connected to IBM Redbooks
  4. Chapter 1. Overview
    1. 1.1 Cloud native applications
    2. 1.2 Twelve factors
    3. 1.3 Microservices
      1. 1.3.1 The meaning of “small”
      2. 1.3.2 Independence and autonomy
      3. 1.3.3 Resilience and Fault tolerance
      4. 1.3.4 Automated environment
    4. 1.4 Philosophy and team structure
    5. 1.5 Examples
      1. 1.5.1 Online retail store
      2. 1.5.2 Game On!
  5. Chapter 2. Creating Microservices in Java
    1. 2.1 Java platforms and programming models
      1. 2.1.1 Spring Boot
      2. 2.1.2 Dropwizard
      3. 2.1.3 Java Platform, Enterprise Edition
    2. 2.2 Versioned dependencies
    3. 2.3 Identifying services
      1. 2.3.1 Applying domain-driven design principles
      2. 2.3.2 Translating domain elements into services
      3. 2.3.3 Application and service structure
      4. 2.3.4 Shared library or new service?
    4. 2.4 Creating REST APIs
      1. 2.4.1 Top down or bottom up?
      2. 2.4.2 Documenting APIs
      3. 2.4.3 Use the correct HTTP verb
      4. 2.4.4 Create machine-friendly, descriptive results
      5. 2.4.5 Resource URIs and versioning
  6. Chapter 3. Locating services
    1. 3.1 Service registry
      1. 3.1.1 Third-party registration versus self-registration
      2. 3.1.2 Availability versus consistency
    2. 3.2 Service invocation
      1. 3.2.1 Server side
      2. 3.2.2 Client side
    3. 3.3 API Gateway
  7. Chapter 4. Microservice communication
    1. 4.1 Synchronous and asynchronous
      1. 4.1.1 Synchronous messaging (REST)
      2. 4.1.2 Asynchronous messaging (events)
      3. 4.1.3 Examples
    2. 4.2 Fault tolerance
      1. 4.2.1 Resilient against change
      2. 4.2.2 Timeouts
      3. 4.2.3 Circuit breakers
      4. 4.2.4 Bulkheads
  8. Chapter 5. Handling data
    1. 5.1 Data-specific characteristics of a microservice
      1. 5.1.1 Domain-driven design leads to entities
      2. 5.1.2 Separate data store per microservice
      3. 5.1.3 Polyglot persistence
      4. 5.1.4 Data sharing across microservices
      5. 5.1.5 Event Sourcing and Command Query Responsibility Segregation
      6. 5.1.6 Messaging systems
      7. 5.1.7 Distributed transactions
    2. 5.2 Support in Java
      1. 5.2.1 Java Persistence API
      2. 5.2.2 Enterprise JavaBeans
      3. 5.2.3 BeanValidation
      4. 5.2.4 Contexts and Dependency Injection
      5. 5.2.5 Java Message Service API
      6. 5.2.6 Java and other messaging protocols
  9. Chapter 6. Application Security
    1. 6.1 Securing microservice architectures
      1. 6.1.1 Network segmentation
      2. 6.1.2 Ensuring data privacy
      3. 6.1.3 Automation
    2. 6.2 Identity and Trust
      1. 6.2.1 Authentication and authorization
      2. 6.2.2 Delegated Authorization with OAuth 2.0
      3. 6.2.3 JSON Web Tokens
      4. 6.2.4 Hash-Based Messaging Authentication Code
      5. 6.2.5 API keys and shared secrets
  10. Chapter 7. Testing
    1. 7.1 Types of tests
    2. 7.2 Application architecture
    3. 7.3 Single service testing
      1. 7.3.1 Testing domain or business function
      2. 7.3.2 Testing resources
      3. 7.3.3 Testing external service requests
      4. 7.3.4 Testing data requests
      5. 7.3.5 Component testing
      6. 7.3.6 Security verification
    4. 7.4 Staging environment
      1. 7.4.1 Test data
      2. 7.4.2 Integration
      3. 7.4.3 Contract
      4. 7.4.4 End-to-end
      5. 7.4.5 Fault tolerance and resilience
    5. 7.5 Production environment
      1. 7.5.1 Synthetic monitoring
      2. 7.5.2 Canary testing
  11. Chapter 8. \From development to production
    1. 8.1 Deployment patterns
    2. 8.2 Deployment pipelines and tools
    3. 8.3 Packaging options
      1. 8.3.1 JAR, WAR, and EAR file deployment on preinstalled middleware
      2. 8.3.2 Executable JAR file
      3. 8.3.3 Containerization
      4. 8.3.4 Every microservice on its own server
      5. 8.3.5 Aspects of running multiple microservices on one server
      6. 8.3.6 Preferred practices on packaging
    4. 8.4 Configuration of the applications across stages
      1. 8.4.1 Environment variables
      2. 8.4.2 Configuration files
      3. 8.4.3 Configuration systems
      4. 8.4.4 Programming considerations
      5. 8.4.5 Preferred practices on configuration
  12. Chapter 9. Management and Operations
    1. 9.1 Metrics and health checks
      1. 9.1.1 Dynamic provisioning
      2. 9.1.2 Health check
    2. 9.2 Logging
    3. 9.3 Templating
  13. Related publications
    1. IBM Redbooks
    2. Other publications
    3. Online resources
    4. Help from IBM
  14. Back cover