eapache

package
v2.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 8, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package eapache provides a circuit breaker adapter using the github.com/eapache/go-resiliency/breaker lib.

Sample backend extra config

...
"extra_config": {
	...
	"github.com/devopsfaith/krakend-circuitbreaker/eapache": {
		"success": 60,
		"timeout": "10s",
		"error": 5
	},
	...
},
...

The eapache package provides an efficient circuit breaker implementation. See https://github.com/eapache/go-resiliency/breaker and https://martinfowler.com/bliki/CircuitBreaker.html for more details.

Index

Constants

View Source
const Namespace = "github.com/devopsfaith/krakend-circuitbreaker/eapache"

Namespace is the key to use to store and access the custom config data

Variables

View Source
var ZeroCfg = Config{}

ZeroCfg is the zero value for the Config struct

Functions

func ConfigGetter

func ConfigGetter(e config.ExtraConfig) interface{}

ConfigGetter implements the config.ConfigGetter interface. It parses the extra config for the eapache adapter and returns a ZeroCfg if something goes wrong.

func NewCircuitBreaker

func NewCircuitBreaker(cfg Config) *breaker.Breaker

NewCircuitBreaker builds a eapache circuit breaker with the injected config

Types

type Config

type Config struct {
	Error   int
	Success int
	Timeout time.Duration
}

Config is the custom config struct containing the params for the eapache/go-resiliency/breaker package

Directories

Path Synopsis
Package eapache provides a circuit breaker proxy middleware using the github.com/eapache/go-resiliency/breaker lib.
Package eapache provides a circuit breaker proxy middleware using the github.com/eapache/go-resiliency/breaker lib.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL