Last active
February 27, 2018 11:25
-
-
Save sohamkamani/f972eddd45116c76df69f2815af7746c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// After importing "github.com/gojektech/heimdall" | |
// Create a new hystrix configuration, and input the command name, along with other required options | |
hystrixConfig := heimdall.NewHystrixConfig("downstream_get_request", heimdall.HystrixCommandConfig{ | |
ErrorPercentThreshold : 20, | |
MaxConcurrentRequests: 30, | |
Timeout: 1000, | |
SleepWindow: 1500 | |
}) | |
// Create a new hystrix-wrapped HTTP client | |
client := heimdall.NewHystrixHTTPClient(1000, hystrixConfig) | |
backoff := heimdall.NewConstantBackoff(500) | |
// Create a new retry mechanism with the backoff | |
retrier := heimdall.NewRetrier(backoff) | |
client.SetRetrier(retrier) | |
client.SetRetryCount(4) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment