Loading documentation...
Loading documentation...
Loading documentation...
Note: This is a developer-maintained documentation page. The content here is not auto-generated and should be updated manually to explain the core concepts and architecture of the circuit package.
Import Path: github.com/kolosys/ion/circuit
Package circuit provides circuit breaker functionality for resilient microservices. Circuit breakers prevent cascading failures by temporarily blocking requests to failing services, allowing them time to recover while providing fast-fail behavior to callers.
The circuit breaker implements a three-state machine:
Usage:
cb := circuit.New("payment-service",
circuit.WithFailureThreshold(5),
circuit.WithRecoveryTimeout(30*time.Second),
)
result, err := cb.Execute(ctx, func(ctx context.Context) (any, error) {
return paymentService.ProcessPayment(ctx, payment)
})The circuit breaker integrates with ION's observability system and supports context cancellation, timeouts, and comprehensive metrics collection.
This section should explain:
Explain the first core concept here.
Explain the second core concept here.
Document why certain approaches were chosen:
// Example code here// Example code hereExplain how this package works with:
This documentation should be updated by package maintainers to reflect the actual architecture and design patterns used.
Note: This is a developer-maintained documentation page. The content here is not auto-generated and should be updated manually to explain the core concepts and architecture of the circuit package.
Import Path: github.com/kolosys/ion/circuit
Package circuit provides circuit breaker functionality for resilient microservices. Circuit breakers prevent cascading failures by temporarily blocking requests to failing services, allowing them time to recover while providing fast-fail behavior to callers.
The circuit breaker implements a three-state machine:
Usage:
cb := circuit.New("payment-service",
circuit.WithFailureThreshold(5),
circuit.WithRecoveryTimeout(30*time.Second),
)
result, err := cb.Execute(ctx, func(ctx context.Context) (any, error) {
return paymentService.ProcessPayment(ctx, payment)
})The circuit breaker integrates with ION's observability system and supports context cancellation, timeouts, and comprehensive metrics collection.
This section should explain:
Explain the first core concept here.
Explain the second core concept here.
Document why certain approaches were chosen:
// Example code here// Example code hereExplain how this package works with:
This documentation should be updated by package maintainers to reflect the actual architecture and design patterns used.
cb := circuit.New("payment-service",
circuit.WithFailureThreshold(5),
circuit.WithRecoveryTimeout(30*time.Second),
)
result, err := cb.Execute(ctx, func(ctx context.Context) (any, error) {
return paymentService.ProcessPayment(ctx, payment)
})// Example code here// Example code herecb := circuit.New("payment-service",
circuit.WithFailureThreshold(5),
circuit.WithRecoveryTimeout(30*time.Second),
)
result, err := cb.Execute(ctx, func(ctx context.Context) (any, error) {
return paymentService.ProcessPayment(ctx, payment)
})// Example code here// Example code here