Giter Site home page Giter Site logo

spring-cloud-intro-demo's Introduction

Sample Credit Card application eco-system

This branch contains the demo with Spring Cloud Netflix Eureka. To see the same demo with other service registries, see the other branches.

After running all the apps execute POST at localhost:9080/application passing cardApplication.json as body.

http POST localhost:9080/application < cardApplication.json
  • new card applications registered via card-service
  • user registered via user-service
  • fraud-service called by card-service and user-service to verify card applications and new users
+-------+                         +-------------+       +-------------+          +-------+             +---------------+  +-------+
| User  |                         | CardService |       | UserService |          | Proxy |             | FraudVerifier |  | Proxy |
+-------+                         +-------------+       +-------------+          +-------+             +---------------+  +-------+
    |                                    |                     |                     |                         |              |
    | Register application               |                     |                     |                         |              |
    |----------------------------------->|                     |                     |                         |              |
    |                                    |                     |                     |                         |              |
    |                                    | Create new user     |                     |                         |              |
    |                                    |------------------------------------------>|                         |              |
    |                                    |                     |                     |                         |              |
    |                                    |                     |     Create new user |                         |              |
    |                                    |                     |<--------------------|                         |              |
    |                                    |                     |                     |                         |              |
    |                                    |                     | Verify new user     |                         |              |
    |                                    |                     |-------------------->|                         |              |
    |                                    |                     |                     |                         |              |
    |                                    |                     |                     | Verify new user         |              |
    |                                    |                     |                     |------------------------>|              |
    |                                    |                     |                     |                         |              |
    |                                    |                     |                     |           User verified |              |
    |                                    |                     |                     |<------------------------|              |
    |                                    |                     |                     |                         |              |
    |                                    |                     |       User verified |                         |              |
    |                                    |                     |<--------------------|                         |              |
    |                                    |                     |                     |                         |              |
    |                                    |        User created |                     |                         |              |
    |                                    |<--------------------|                     |                         |              |
    |                                    |                     |                     |                         |              |
    |                                    |                     |                     |                         | User created |
    |                                    |<-----------------------------------------------------------------------------------|
    |                                    |                     |                     |                         |              |
    |                                    | Verify card application                   |                         |              |
    |                                    |-------------------------------------------------------------------->|              |
    |                                    |                     |                     |                         |              |
    |                                    |                     |                     Card application verified |              |
    |                                    |<--------------------------------------------------------------------|              |
    |                                    |                     |                     |                         |              |
    |        Card application registered |                     |                     |                         |              |
    |<-----------------------------------|                     |                     |                         |              |
    |                                    |                     |                     |                         |              |

Setup using new stack

Client side load-balancing using LoadBalancerClient

  • @LoadBalanced RestTemplate uses Spring Cloud LoadBalancer under the hood

Apps communicating via Gateway:

  • Routes have to be explicitly defined
  • Possibility to configure routes either via properties or Java configuration
  • All headers passed by default
  • Routes matched using predicates, requests modified using filters

Spring Cloud Circuit Breaker + Resilience4J

  • Interactions defined using injected CircuitBreakerFactory via the create() method
  • HTTP call and fallback method defined
  • Circuit breaker configuration modified in Customizer<CircuitBreaker bean in a @Configuration class
  • Resilience4J used underneath

Centralised configuration with Spring Cloud ConfigServer

  • card-service connects to ConfigServer to retrieve property values
  • ConfigServer backed by a git repository
  • Updating property values in a running application by using @RefreshScope beans and /actuator/refresh endpoint

Micrometer + Prometheus

  • HTTP traffic monitoring using Micrometer + Prometheus
  • Added a Micrometer's Timer to VerificationServiceClient

spring-cloud-intro-demo's People

Contributors

olgamaciaszek avatar marcingrzejszczak avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.