tsarenkotxt / spring-boot-feign-ribbon-hystrix-example

Spring Boot with Feign/Ribbon/Hystrix example

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Spring Boot with Feign/Ribbon/Hystrix example

Simple Spring Boot application:

  • feign client
    • ribbon - load balancer, retries configurations...
    • hystrix - fallback

Get started

Run the Spring Boot application:

./gradlew bootRun

Fetch user:

curl http://localhost:8080/

Configurations

user-client:
  ribbon:
    eureka:
      # Disables eureka for simple demo
      enabled: false
    # List of urls for user-client
    listOfServers: localhost:8080
    # Max number of retries on the same server (excluding the first try)
    MaxAutoRetries: 5
    # Max number of next servers to retry (excluding the first server)
    MaxAutoRetriesNextServer: 5
    # Interval to refresh the server list from the source
    ServerListRefreshInterval: 2000
    # Whether all operations can be retried for this client
    OkToRetryOnAllOperations: true
    # Connect timeout used by Apache HttpClient
    ConnectTimeout: 3000
    # Read timeout used by Apache HttpClient
    ReadTimeout: 3000

feign:
  hystrix:
    # Enable hystrix for feign
    enabled: true

logging:
  level:
    com:
      # Enables debug logs for demo
      netflix: DEBUG

Reference Documentation

About

Spring Boot with Feign/Ribbon/Hystrix example


Languages

Language:Java 100.0%