Skip to main content

Module context

Module context 

Source
Expand description

Script execution context ports.

When a job is scheduled, Chronon stores actor_json on the job record. When a worker dispatches the script, it calls ContextFactory::build to reconstruct handler context from that JSON. Script handlers (including those defined with #[chronon::script]) receive the result as Box<dyn ScriptContext>.

§Choosing a factory

ApproachWhen to use
JsonScriptContextFactoryExamples, smoke tests, and handlers that only need ScriptContext::label and ScriptContext::actor_json
Custom ContextFactoryProduction apps that map actor JSON to sessions, permissions, database access, or other application identity

Install the factory at runtime boot on ChrononBuilder (see chronon-runtime).

Structs§

IdentityError
Identity reconstruction failure.
JsonScriptContextFactory
Default factory that wraps actor JSON in a labeled ScriptContext.
NoOpContextFactory
Factory that always returns NoOpScriptContext.
NoOpScriptContext
No-op context for tests and benchmarks.

Traits§

ContextFactory
Builds a ScriptContext from JSON captured at schedule time.
ScriptContext
Opaque execution context for script handlers.