You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description: When fetching time-sensitive market data, relying on a single upstream provider is a single point of failure. This example will show how to use Resile's stateful retries to seamlessly rotate through fallback HTTP endpoints.
Architecture & Implementation Requirements:
Setup: Create examples/http_rotation/main.go.
Configuration: Define a slice of backend URLs: ["api.primary-data.com", "api.backup-vendor.com", "api.fallback.com"].
Execution: Use resile.DoState. In the closure, use state.Attempt and the modulo operator (%) to select the URL from the slice.
Failure Emulation: Use aggressive, low-timeout configurations (e.g., 500ms) on the HTTP client so that if the primary provider is lagging, Resile instantly cancels the context and fires the next attempt at the backup vendor.
Acceptance Criteria:
Demonstrate how to keep the HTTP client instantiated outside the retry loop to reuse TCP connections (Keep-Alives).
Demonstrate returning the successfully fetched JSON payload using Go generics.
Description: When fetching time-sensitive market data, relying on a single upstream provider is a single point of failure. This example will show how to use Resile's stateful retries to seamlessly rotate through fallback HTTP endpoints.
Architecture & Implementation Requirements:
examples/http_rotation/main.go.["api.primary-data.com", "api.backup-vendor.com", "api.fallback.com"].resile.DoState. In the closure, usestate.Attemptand the modulo operator (%) to select the URL from the slice.Acceptance Criteria: