java - Fallback methods at Zuul server in Spring cloud -


i new in spring cloud netflix , have questions concerning it.
using api gateway hystrix running @ zuul edge server , make sure if understand following behavior correctly:

i kill microservice running "behind" api gateway force hystrix open circuit. after (ca 10 seconds) send request non-running microservice , receive timeout error. when send many (tens) of requests in short time (up 1 sec), receive shortcircuit open error.
surprised why receive timeout error although circuit open , therefore hystrix should come play avoid such kind of failures. guess reason if time since last request > circuitbreaker.sleepwindowinmilliseconds, api gateway tries connect microservice again check if it's alive, wasn't, -> timeout. explain, why got shortcircuit open error on many requests in short time.

the next thing receive "timeout" or "shortcircuit" error got:

hystrixruntimeexception: microservice (timed-out | short-circuited) , no fallback available 

how can specify fallback @ zuul server (this can same routes) avoid exception ?
have tried until now:

  • according this set execution isolation strategy thread avoid time-out:

    hystrix: command.default.execution.isolation.strategy: thread

but after looking @ hystrix.stream got propertyvalue_executionisolationstrategy":"semaphore"

  • there seems hint solution on github writing custom ribboncommand , overriding getfallback(), after looking @ ribboncommand interface. found out, neither ribboncommand nor super interfaces doesn't define such method.

my api gateway service:

@springbootapplication @enablesidecar // annotation includes @enablecircuitbreaker, @enablediscoveryclient, , @enablezuulproxy @enablehystrixdashboard public class apigatewayapplication {      public static void main(string[] args) {         springapplication.run(apigatewayapplication.class, args);     }  } 

application.yml

server:   port: 10000 sidecar:   port: 8000 endpoints:   restart:     enabled: true   shutdown:     enabled: true   health:     sensitive: false eureka:   client:     registerwitheureka: true     fetchregistry: true     serviceurl:       defaultzone: http://localhost:8761/eureka/ zuul:   routes:     microservice:       path: /microservice/**  hystrix:   command.default.execution.isolation.strategy: thread  debug: true 

the latest release supports fallback @ zuul level. done extending zuulfallbackprovider. please visit below link example: https://github.com/spring-cloud-samples/zuul-server/blob/master/src/main/java/zuulserver/zuulserverapplication.java

the fallback triggering not done types of route configurations (for eg if have url based config)

"these simple url-routes don’t executed hystrixcommand nor can loadbalance multiple urls ribbon."


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -