circuit_breaker 1.0.1
circuit_breaker: ^1.0.1 copied to clipboard

Implementation of the Circuit Breaker Design Pattern for HTTP requests

Circuit Breaker #

pub package Build Status GitHub top language

Using #

Create #

final http = Client();
final Request request = Request('POST', Uri.parse('http://example.com'));

final cb = CircuitBreaker(
    request: request,
    failureThreshold: 3,
    successThreshold: 5,
    timeout: Duration(seconds: 2));

Results #

await cb.execute()
    .then((value){
        print("Success breaker");
    }).catchError((error, stack){
        print("Fail breaker");
    });

OR

// 2
final result = await cb.execute();
print(result.statusCode);
print(result.body);
print(result.state);
print(result.nextAttempt);
1
likes
130
pub points
0%
popularity

Publisher

codenetworks.dev

Implementation of the Circuit Breaker Design Pattern for HTTP requests

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

http, meta, pedantic

More

Packages that depend on circuit_breaker