Last active
March 9, 2017 03:42
-
-
Save pallocchi/543cb925f9761690fbc7e73501e74783 to your computer and use it in GitHub Desktop.
Using Java 8 lambdas with Netflix Hystrix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CommandHelloWorld extends HystrixCommand<String> { | |
private final String name; | |
public CommandHelloWorld(String name) { | |
super(Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey("ExampleGroup")) | |
.andCommandKey(HystrixCommandKey.Factory.asKey("ExampleCommand"))) | |
.andCommandPropertiesDefaults(HystrixCommandProperties.Setter().withExecutionTimeoutInMilliseconds(5000)); | |
this.name = name; | |
} | |
@Override | |
protected String run() { | |
return "Hello " + name + "!"; | |
} | |
@Override | |
protected String getFallback() { | |
return "Hello anonymous!"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment