Microservice Patterns - Implemented by Eclipse MicroProfile

Microservice Patterns - Implemented by Eclipse MicroProfile

Eclipse MicroProfile provides specifications for the most commonly used microservice patterns. In this session, I will go quickly through a selection of microservice patterns and show how they are implemented by Eclipse MicroProfile.

Patterns covered by this session are:

Microservice Architectures
Circuit Breaker
Externalized Configuration
Health Check API
Application Metrics
Service per Container
Distributed Tracing
Access Token
Each pattern will be in explained and demoed live in a down-to-earth and easily understandable way.

There will be live coding and demo of all technologies implementing the patterns.

B489790e1a844284d7cd1fa2cd6e021f?s=128

ivargrimstad

November 07, 2019
Tweet

Transcript

  1. COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE AVAILABLE UNDER

    THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) Microservice Patterns Implemented by Eclipse MicroProfile Ivar Grimstad
 Jakarta EE Developer Advocate, Eclipse Foundation
  2. @ivar_grimstad https://github.com/ivargrimstad https://www.linkedin.com/in/ivargrimstad

  3. COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE AVAILABLE UNDER

    THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0)
  4. @ivar_grimstad #MicroProfile COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE

    AVAILABLE UNDER THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) Eclipse MicroProfile
  5. COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE AVAILABLE UNDER

    THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) @ivar_grimstad #MicroProfile
  6. COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE AVAILABLE UNDER

    THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) @ivar_grimstad #MicroProfile M icroProfile 3.1 October 9, 2019
  7. COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE AVAILABLE UNDER

    THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) @ivar_grimstad #MicroProfile Open Liberty
  8. COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE AVAILABLE UNDER

    THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) @ivar_grimstad #MicroProfile java -jar dukes.jar
  9. COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE AVAILABLE UNDER

    THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) @ivar_grimstad #MicroProfile
  10. @ivar_grimstad #MicroProfile COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE

    AVAILABLE UNDER THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) Getting Started
  11. COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE AVAILABLE UNDER

    THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) @ivar_grimstad #MicroProfile
  12. @ivar_grimstad #MicroProfile COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE

    AVAILABLE UNDER THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) Microservice Patterns
  13. @ivar_grimstad #MicroProfile COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE

    AVAILABLE UNDER THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) 1. Externalised Configuration 2. Health Check API 3. Application Metrics 4. Circuit Breaker 5. Access Token 6. Distributed Tracing 7. API Description
  14. @ivar_grimstad #MicroProfile COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE

    AVAILABLE UNDER THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) Externalised Configuration
  15. @ivar_grimstad #MicroProfile COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE

    AVAILABLE UNDER THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) How to enable a service to run in multiple environments without modification?
  16. @ivar_grimstad #MicroProfile COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE

    AVAILABLE UNDER THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) Configuration for MicroProfile
  17. COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE AVAILABLE UNDER

    THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) @ivar_grimstad #MicroProfile System Properties System.getProperties() Environment Variables System.getenv() Application Configuration META-INF/microprofile-config.properties
  18. COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE AVAILABLE UNDER

    THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) @ivar_grimstad #MicroProfile
  19. @ivar_grimstad #MicroProfile COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE

    AVAILABLE UNDER THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) DEMO
  20. @ivar_grimstad #MicroProfile COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE

    AVAILABLE UNDER THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) Health Check API
  21. @ivar_grimstad #MicroProfile COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE

    AVAILABLE UNDER THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) How to detect that a running service instance is unable to handle requests?
  22. @ivar_grimstad #MicroProfile COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE

    AVAILABLE UNDER THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) MicroProfile Health API
  23. COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE AVAILABLE UNDER

    THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) @ivar_grimstad #MicroProfile
  24. @ivar_grimstad #MicroProfile COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE

    AVAILABLE UNDER THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) DEMO
  25. @ivar_grimstad #MicroProfile COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE

    AVAILABLE UNDER THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) Application Metrics
  26. @ivar_grimstad #MicroProfile COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE

    AVAILABLE UNDER THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) How to understand the behavior of an application and troubleshoot problems?
  27. @ivar_grimstad #MicroProfile COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE

    AVAILABLE UNDER THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) MicroProfile Metrics
  28. COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE AVAILABLE UNDER

    THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) @ivar_grimstad #MicroProfile
  29. @ivar_grimstad #MicroProfile COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE

    AVAILABLE UNDER THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) DEMO
  30. @ivar_grimstad #MicroProfile COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE

    AVAILABLE UNDER THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) Circuit Breaker
  31. @ivar_grimstad #MicroProfile COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE

    AVAILABLE UNDER THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) How to prevent a network or service failure from cascading to other services?
  32. COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE AVAILABLE UNDER

    THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) @ivar_grimstad #MicroProfile
  33. COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE AVAILABLE UNDER

    THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) @ivar_grimstad #MicroProfile
  34. @ivar_grimstad #MicroProfile COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE

    AVAILABLE UNDER THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) DEMO
  35. @ivar_grimstad #MicroProfile COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE

    AVAILABLE UNDER THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) Access Token
  36. @ivar_grimstad #MicroProfile COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE

    AVAILABLE UNDER THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) How to communicate the identity of the requestor to the services that handle the request?
  37. @ivar_grimstad #MicroProfile COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE

    AVAILABLE UNDER THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) Basic Authentication
  38. COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE AVAILABLE UNDER

    THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) @ivar_grimstad #MicroProfile POST /hello HTTP/1.1 Host: localhost:8080 Authorization: Basic c25vb3850nBhc3M= User-Agent: HTTPie/0.9.9 Accept: */* Content-Type: application/json Content-Length: 26 {“message”:“Hello, Duke!”}
  39. @ivar_grimstad #MicroProfile COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE

    AVAILABLE UNDER THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) OAuth 2.0
  40. COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE AVAILABLE UNDER

    THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) @ivar_grimstad #MicroProfile POST /hello HTTP/1.1 Host: localhost:8080 Authorization: Bearer 2YotnF2FEjrlzCsidMWpAA User-Agent: HTTPie/0.9.9 Accept: */* Content-Type: application/json Content-Length: 26 {“message”:“Hello, Duke!”} POST /hello HTTP/1.1 Host: localhost:8080 Authorization: Basic c25vb3850nBhc3M= User-Agent: HTTPie/0.9.9 Accept: */* Content-Type: application/json Content-Length: 26 {“message”:“Hello, Duke!”} POST /hello HTTP/1.1 Host: localhost:8080 Authorization: Bearer 2YotnF2FEjrlzCsidMWpAA User-Agent: HTTPie/0.9.9 Accept: */* Content-Type: application/json Content-Length: 26 {“message”:“Hello, Duke!”}
  41. @ivar_grimstad #MicroProfile COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE

    AVAILABLE UNDER THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) JSON Web Token (JWT)
  42. COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE AVAILABLE UNDER

    THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) @ivar_grimstad #MicroProfile POST /hello HTTP/1.1 Host: localhost:8080 Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiQ mVhcmVyIiwiYXVkIjoic2ltcGxlYXBwIiwic3ViIjoiYm9iIiwidXBuIjo iYm9iIiwiY3VzdG9tQ2xhaW0iOiJjdXN0b21WYWx1ZSIsImdyb3VwcyI6W yJhZG1pbiIsInVzZXIiXSwiaXNzIjoiaHR0cDovL29wZW5saWJlcnR5Lml vIiwiZXhwIjoxNTI1MzM5MjU5LCJpYXQiOjE1MjUyNTI4NTl9.nDDpCR2w MWsENaDGORQblErOCJ6ii1R-N6iSzVsAz2RoUlvM2PrST2qT6kje-Nz9vc ptbSpOSlF1OuJydvP8Tg3puJKI5vGyL4RMowgJHwdvv7hMZvrK1loNrPfb yv727L9UwJSZMdzL_sibiXDuj-bIBIr6yGjVF86aQnh-PWBV8HHM1iW8l1 _y351lp2CAPkfjKwLU91iIT1jO1QCwItF8Dv-zAzmhd_rOIF58eB809_5r m0MMGIuAXdgUiU2bdEJQCkTWJKNNaSu5oddZzlKaCX4hIgBdrVV6447DM0 i31YRhLpYHfbzh_NlRrRPjGPNgzOIN1RInwPC8jdg_g User-Agent: HTTPie/0.9.9 Accept: */* Content-Type: application/json Content-Length: 26 {“message”:“Hello, Duke!”}
  43. COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE AVAILABLE UNDER

    THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) @ivar_grimstad #MicroProfile POST /hello HTTP/1.1 Host: localhost:8080 Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiQ mVhcmVyIiwiYXVkIjoic2ltcGxlYXBwIiwic3ViIjoiYm9iIiwidXBuIjo iYm9iIiwiY3VzdG9tQ2xhaW0iOiJjdXN0b21WYWx1ZSIsImdyb3VwcyI6W yJhZG1pbiIsInVzZXIiXSwiaXNzIjoiaHR0cDovL29wZW5saWJlcnR5Lml vIiwiZXhwIjoxNTI1MzM5MjU5LCJpYXQiOjE1MjUyNTI4NTl9.nDDpCR2w MWsENaDGORQblErOCJ6ii1R-N6iSzVsAz2RoUlvM2PrST2qT6kje-Nz9vc ptbSpOSlF1OuJydvP8Tg3puJKI5vGyL4RMowgJHwdvv7hMZvrK1loNrPfb yv727L9UwJSZMdzL_sibiXDuj-bIBIr6yGjVF86aQnh-PWBV8HHM1iW8l1 _y351lp2CAPkfjKwLU91iIT1jO1QCwItF8Dv-zAzmhd_rOIF58eB809_5r m0MMGIuAXdgUiU2bdEJQCkTWJKNNaSu5oddZzlKaCX4hIgBdrVV6447DM0 i31YRhLpYHfbzh_NlRrRPjGPNgzOIN1RInwPC8jdg_g User-Agent: HTTPie/0.9.9 Accept: */* Content-Type: application/json Content-Length: 26 {“message”:“Hello, Duke!”}
  44. @ivar_grimstad #MicroProfile ✦Header ✦ JSON, Base64 URL Encoded ✦ Algorithm,

    Type ✦Payload ✦ JSON, Base64 URL Encoded ✦ Standard + Custom entries ✦Signature ✦ Binary, Base64 URL Encoded ✦ The actual signature
  45. COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE AVAILABLE UNDER

    THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) @ivar_grimstad #MicroProfile POST /hello HTTP/1.1 Host: localhost:8080 Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiQ mVhcmVyIiwiYXVkIjoic2ltcGxlYXBwIiwic3ViIjoiYm9iIiwidXBuIjo iYm9iIiwiY3VzdG9tQ2xhaW0iOiJjdXN0b21WYWx1ZSIsImdyb3VwcyI6W yJhZG1pbiIsInVzZXIiXSwiaXNzIjoiaHR0cDovL29wZW5saWJlcnR5Lml vIiwiZXhwIjoxNTI1MzM5MjU5LCJpYXQiOjE1MjUyNTI4NTl9.nDDpCR2w MWsENaDGORQblErOCJ6ii1R-N6iSzVsAz2RoUlvM2PrST2qT6kje-Nz9vc ptbSpOSlF1OuJydvP8Tg3puJKI5vGyL4RMowgJHwdvv7hMZvrK1loNrPfb yv727L9UwJSZMdzL_sibiXDuj-bIBIr6yGjVF86aQnh-PWBV8HHM1iW8l1 _y351lp2CAPkfjKwLU91iIT1jO1QCwItF8Dv-zAzmhd_rOIF58eB809_5r m0MMGIuAXdgUiU2bdEJQCkTWJKNNaSu5oddZzlKaCX4hIgBdrVV6447DM0 i31YRhLpYHfbzh_NlRrRPjGPNgzOIN1RInwPC8jdg_g User-Agent: HTTPie/0.9.9 Accept: */* Content-Type: application/json Content-Length: 26 {“message”:“Hello, Duke!”}
  46. COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE AVAILABLE UNDER

    THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) @ivar_grimstad #MicroProfile { “alg”: “RS256”, “typ”: “JWT} { “token-type: “access-token”, “username”: “duke”, “scopes”: [ “java”: “everywhere” ], “exp”: 1474280963, “iat”: 1474279163 “jti”: “66881b068b249ad9” } nDDpCR2wMWsENaDGORQblErOCJ6ii1R-N6iSzVsAz2RoUlvM2PrST2qT6kje-Nz 9vcptbSpOSlF1OuJydvP8Tg3puJKI5vGyL4RMowg-JHwdvv7hMZvrK1loNrPfby v727L9UwJSZMdzL_sibiXDuj-bIBIr6yGjVF86aQnh-PWBV8HHM1iW8l1_y351l p2CAPkfjKwLU91iIT1jO1QCwItF8Dv-zAzmhd_rOIF58eB809_5rm0MMGIuAXdg UiU2bdEJQCkTWJKNNaSu5oddZzlKaCX4hIgBdrVV6447DM0i31YRhLpYHfbzh_N lRrRPjGPNgzOIN1RInwPC8jdg_g
  47. COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE AVAILABLE UNDER

    THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) @ivar_grimstad #MicroProfile
  48. @ivar_grimstad #MicroProfile COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE

    AVAILABLE UNDER THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) DEMO
  49. @ivar_grimstad #MicroProfile COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE

    AVAILABLE UNDER THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) Distributed Tracing
  50. @ivar_grimstad #MicroProfile COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE

    AVAILABLE UNDER THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) How to understand the behavior of an application and troubleshoot problems?
  51. @ivar_grimstad #MicroProfile

  52. COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE AVAILABLE UNDER

    THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) @ivar_grimstad #MicroProfile
  53. @ivar_grimstad #MicroProfile COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE

    AVAILABLE UNDER THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) DEMO
  54. @ivar_grimstad #MicroProfile COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE

    AVAILABLE UNDER THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) API Description
  55. @ivar_grimstad #MicroProfile COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE

    AVAILABLE UNDER THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) Which knowledge should be shared between an API provider and its clients? How should this knowledge be documented?
  56. COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE AVAILABLE UNDER

    THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) @ivar_grimstad #MicroProfile
  57. @ivar_grimstad #MicroProfile COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE

    AVAILABLE UNDER THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) DEMO
  58. COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE AVAILABLE UNDER

    THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) Summary
  59. COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE AVAILABLE UNDER

    THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) @ivar_grimstad #MicroProfile
  60. @ivar_grimstad #MicroProfile COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE

    AVAILABLE UNDER THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) 1. Externalised Configuration 2. Health Check API 3. Application Metrics 4. Circuit Breaker 5. Access Token 6. Distributed Tracing 7. API Description
  61. COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE AVAILABLE UNDER

    THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) @ivar_grimstad #MicroProfile Microservice Patterns http://microservices.io
 https://microservice-api-patterns.org/ Samples https://github.com/ivargrimstad Microprofile http://microprofile.io Jakarta EE https://jakarta.ee
  62. Duke's Choice Award Winner