MoonResilience is a MoonBit resilience toolkit for service calls, job execution, message handling, and other infrastructure-facing workloads. It provides retry policies, circuit breaking, rate limiting, bulkhead isolation, and a unified execution entry for composing those controls.
The first version is intentionally kept as a pure MoonBit core library. It does not depend on any framework runtime, so it can be reused in CLI tools, backend components, scheduling logic, and teaching examples around stability control.
Why this project
Resilience controls are a common requirement in mature backend systems:
retry transient failures without hiding permanent faults
stop cascading failures with circuit breaking
smooth burst traffic with rate limiting
isolate expensive or unstable work with bulkheads
MoonResilience packages these controls as a small reusable MoonBit library instead of scattering ad hoc logic across projects.
Core capabilities
fixed and exponential backoff retry policies
circuit breaker with Closed, Open, and HalfOpen states
token-bucket style rate limiter
bulkhead isolation with explicit in-flight capacity
event recording hooks for retries, breaker transitions, limiter rejection, and bulkhead rejection
unified execute_with flow for composing the controls
MoonResilience
MoonResilience is a MoonBit resilience toolkit for service calls, job execution, message handling, and other infrastructure-facing workloads. It provides retry policies, circuit breaking, rate limiting, bulkhead isolation, and a unified execution entry for composing those controls.
The first version is intentionally kept as a pure MoonBit core library. It does not depend on any framework runtime, so it can be reused in CLI tools, backend components, scheduling logic, and teaching examples around stability control.
Why this project
Resilience controls are a common requirement in mature backend systems:
MoonResilience packages these controls as a small reusable MoonBit library instead of scattering ad hoc logic across projects.
Core capabilities
Closed,Open, andHalfOpenstatesexecute_withflow for composing the controlsRepository links
Package layout
@q2weasd/moonresiliencecmd/maindocs/competitionQuick start
Example
Current scope
The current version focuses on a stable core model:
now_msResilienceHooksPlanned follow-up work includes metrics adapters, configuration loading, and integration wrappers for HTTP clients or job runners.
License
Apache-2.0