Hystrix: Retry Support in Hystrix

Created on 13 Nov 2015  路  2Comments  路  Source: Netflix/Hystrix

Hi,

Is there any support for retry in Hystrix .

I am invoking rest service using spring-cloud-feign . If rest-service is not available ,then i am using hystrix to call fallback method , it works perfectly.

Now i want a retry mechanism , so that failed rest call should be re-invoked after some time by some background process. Basically i am looking for something like this :


@Retry(retryCount = 2, fallbackMethod = "fallBackgreet")
public Greeting greet(String name) {
return greetingServiceFeignClient.greet(name);
}

public Greeting fallBackgreet(String name)  {
    Greeting greeting = new Greeting();
    greeting.setContent("Retry " + name);
    return greeting;
}

As you can see , i have developed my own retry annotation ,which invokes feign client in background , but i am looking for something standard instead of developing my own.

hystrix-core question

Most helpful comment

@VikasJindal84 Hystrix treats the execution that gets wrapped as a black-box. Because only some executions benefit from a retry policy, Hystrix does not add the complexity of retry.

Internally at Netflix, each type of work that gets wrapped (HTTP/DB/Cache/etc) has different semantics and we do the work of configuring policies at the HTTP client/DB client/Cache client level and then wrapping with Hystrix.

All 2 comments

@VikasJindal84 Hystrix treats the execution that gets wrapped as a black-box. Because only some executions benefit from a retry policy, Hystrix does not add the complexity of retry.

Internally at Netflix, each type of work that gets wrapped (HTTP/DB/Cache/etc) has different semantics and we do the work of configuring policies at the HTTP client/DB client/Cache client level and then wrapping with Hystrix.

You could have a look at https://github.com/spring-projects/spring-retry as an alternative.

Was this page helpful?
0 / 5 - 0 ratings