chronon-macros
Proc macros for Chronon scheduled scripts.
Provides #[chronon::script] for defining scripts with typed parameter structs and Quark inventory registration.
Audience: Application developers authoring scheduled script handlers.
Quick start
- Annotate an async function with
#[chronon::script(name = "...")]. - First parameter must be
Box<dyn ScriptContext>. - Add crate dependencies (below).
- Link the defining crate into your worker binary.
- Boot Chronon with
.auto_registry()and aContextFactory. - Enqueue jobs via the scheduler store / HTTP API using the script name.
Runnable examples:
chronon/examples/script_macro.rs— stringlyJob::new+ upsertchronon/examples/script_handle_job.rs— typedScriptHandledefaults
Consumer dependencies
Crates that define scripts need:
= { = "0.1" }
= { = "uf-quark", = "0.1.1" }
= { = "0.1" }
= { = "0.1" }
= { = "1", = ["derive"] }
= "1"
Or depend on the facade with the macro re-exported (crates.io package is uf-chronon; the unrelated crate named chronon is not this project):
= { = "uf-chronon", = "0.1", = ["mem"] }
Link closure
Inventory registration happens at link time. The binary that runs Chronon workers must depend on every crate that defines #[chronon::script] handlers.
Identity
Handlers receive Box<dyn ScriptContext>. At boot, install a factory on ChrononBuilder:
JsonScriptContextFactoryfor examples and actor-json-only handlers.- A custom
ContextFactorywhen handlers need application-specific session state rebuilt fromactor_json.
Host applications often publish identity adapters as separate crates and recover typed context inside the handler body.
Documentation