Skip to content

Instantly share code, notes, and snippets.

@sohamkamani
Last active February 27, 2018 11:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sohamkamani/f972eddd45116c76df69f2815af7746c to your computer and use it in GitHub Desktop.
Save sohamkamani/f972eddd45116c76df69f2815af7746c to your computer and use it in GitHub Desktop.
// 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