elsa-core/doc/wiki/http-scheduling-resilience.md
2026-05-23 14:19:02 +00:00

6.7 KiB

HTTP, Scheduling, And Resilience

HTTP, scheduling, and resilience are extension modules layered on top of workflow core, management, runtime, and expressions.

HTTP Module

Start in src/modules/Elsa.Http.

HttpFeature owns:

  • inbound HTTP endpoint workflows
  • outbound HTTP request activities
  • route matching and route table updates
  • HTTP bookmark payloads
  • HTTP request/response content parsing and writing
  • downloadable content handling
  • file cache and zip management
  • correlation and workflow instance ID selectors
  • HTTP activity descriptors and UI hints
  • HTTP resilience strategy registration
  • HTTP ingress source registration for graceful shutdown

The public module extension is UseHttp.

Inbound HTTP Workflows

The inbound path is:

flowchart LR
    Request["ASP.NET request"] --> Middleware["HttpWorkflowsMiddleware"]
    Middleware --> RouteTable["IRouteTable / IRouteMatcher"]
    RouteTable --> Lookup["IHttpWorkflowLookupService"]
    Lookup --> Runtime["Workflow runtime"]
    Runtime --> Activity["HttpEndpoint activity"]
    Activity --> Response["HTTP response activity"]

Important files:

Hosts enable middleware with UseWorkflows.

Outbound HTTP

Outbound HTTP activities:

Supporting services include HttpClientFileDownloader, content factories, content parsers, and downloadable content handlers.

HTTP Security And Faults

HTTP endpoint authorization and faults are configurable through HttpFeature:

The module registers authorization services because the authentication-based handler requires them.

HTTP Tests

Good test entry points:

Scheduling Module

Start in src/modules/Elsa.Scheduling.

SchedulingFeature registers:

  • local scheduler
  • cron parser
  • trigger scheduler
  • bookmark scheduler
  • workflow scheduler
  • tenant schedule updater
  • create-schedules background task
  • ScheduleWorkflows handlers
  • Cron trigger payload validator
  • scheduled-trigger ingress source for graceful shutdown
  • scheduling activities through workflow management

The public extension is UseScheduling.

Scheduling Concepts

Scheduled workflows typically create trigger or bookmark payloads that the scheduler can wake later. Important files:

The scheduler integrates with tenancy by reacting to tenant activation/deletion events.

Resilience Module

Start in src/modules/Elsa.Resilience and Elsa.Resilience.Core.

ResilienceFeature registers:

  • activity descriptor modifier for resilient activities
  • resilience strategy catalog
  • strategy config evaluator
  • resilient activity invoker
  • configuration strategy source
  • retry attempt recorders/readers
  • transient exception detector and strategy
  • FastEndpoints assembly for resilience descriptors/testing endpoints

HTTP registers HttpResilienceStrategy with resilience in HttpFeature.Configure().

Resilience Concepts

Core contracts:

Use resilience when an activity performs IO that can fail transiently. Keep strategy types registered by the owning module.

The resilience testing endpoint GET /elsa/api/simulate-response is included in the module. It requires exec:resilience:simulate-response (or wildcard exec:resilience or exec:*) and is intended for integration-testing resilience strategies, not for production traffic.

Cross-Cutting Graceful Shutdown

HTTP and Scheduling both register runtime ingress sources so graceful shutdown can pause new external work. When adding a new external event source, implement and register an IIngressSource in the owning module, then add runtime tests that prove pause/resume/drain behavior.