A codegen tool for easy adoption of resiliency patterns
1.5K
Reinforcer is a code generation tool that automates middleware injection in a proxy service that fronts your delegate implementation, this aids in building more resilient code as you can use common resiliency patterns in the middlewares such as circuit breakers, retrying, timeouts and others.
NOTE: This tool is under heavy development, not yet recommended for production use.
Visit the releases page for pre-built binaries for OS X, Linux and Windows.
Use the Docker Image:
docker pull csueiras/reinforcer
Install through Homebrew
brew tap csueiras/reinforcer && brew install reinforcer
type Client interface {
DoOperation(ctx context.Context, arg string) error
}
r := runner.NewFactory(
metrics.NewMiddleware(...),
circuitbreaker.NewMiddleware(...),
bulkhead.NewMiddleware(...),
retry.NewMiddleware(...),
timeout.NewMiddleware(...),
)
errPredicate := func(method string, err error) bool {
if method == "DoOperation" && errors.Is(client.NotFound, err) {
return false
}
return true
}
c := client.NewClient(...)
// reinforcedClient implements the target interface so it can now be used in lieau of any place where the unreliable
// client was used
reinforcedClient := reinforced.NewClient(c, r, reinforced.WithRetryableErrorPredicate(errPredicate))
A complete example is here
Content type
Image
Digest
Size
109.4 MB
Last updated
over 5 years ago
docker pull csueiras/reinforcer