Skip to content
This repository has been archived by the owner on Oct 15, 2019. It is now read-only.

Need different set of API to register a hook to "Interface Proxy" to implement Retry and Load Balance #276

Closed
supercharger opened this issue Oct 13, 2015 · 2 comments

Comments

@supercharger
Copy link

I couldn't find a API to register a hook so that a service method call can be retried, and Load balance among set of servers.

For ex:

 ExampleService client = thriftClient.open(connector).get();
 client.sayHello();

To handle sayHello method failure, and load balance.
There is no clean way to achieve do this, without writing boiler plate code at the application side or some library which works by having a Proxy around "Swift returned Proxy" to achieve it.

@supercharger
Copy link
Author

Any thoughts on this ?
I think we need a different Channel implementation than the current one.

@vicmosin
Copy link

vicmosin commented Oct 5, 2016

@supercharger
what do you think about using this lib to provide some simple retrying feature:

private final Retryer retryer = RetryerBuilder.newBuilder()
        .retryIfException()
        .withWaitStrategy(WaitStrategies.fixedWait(1, TimeUnit.SECONDS))
        .withStopStrategy(StopStrategies.stopAfterAttempt(3))
        .build();
...
try {
    S service = new ThriftClient<>(clientManager, serviceClass, clientConfig, "thriftClient")
             .open(connector).get();
    return (T) retryer.call(() -> {
        return workFn.apply(service);
   });
} catch (ExecutionException | RetryException e) {
       throw new DataAccessException(e);
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants