aion-worker
Rust remote-worker SDK for registering typed Aion activities and serving them from an aion-server task queue.
This is a library crate — it ships no binaries, so cargo install aion-worker fails by design. A worker is your own crate:
Key public types
Worker,WorkerBuilder, andWorkerConfigconfigure and run a remote worker.ActivityRegistry,TypedActivityDispatcher, andActivityDispatcherregister activity handlers.ActivityContext,HeartbeatRequest, and cancellation handles provide per-task context.WorkerSession,GrpcWorkerSession, andWorkerSessionEventmodel the worker protocol.ActivityFailure,WorkerError, andWorkerConfigBuildErrorreport handler and runtime failures.
Install
[]
= "0.4.0"
Minimal worker
Register at least one activity on the builder, build the worker, and start the async run loop:
use Duration;
use ;
use ;
async
Trait bounds to know before fighting the compiler:
- Input types require
Serialize + DeserializeOwned + Send + Sync + 'static— derive bothSerializeandDeserialize. - Output types require
Serialize + Send + Sync + 'static. - Handlers are
for<'context> Fn(Input, &'context ActivityContext)returningHandlerFuture<'context, Output>— a pinned, boxed,Sendfuture ofResult<Output, ActivityFailure>; wrap anasync moveblock inBox::pin(...)as above.
Every WorkerConfig field shown is required — there are no hidden defaults. Handlers fail with an explicit classification — ActivityFailure::retryable(message) or ActivityFailure::terminal(message) (attach structured detail with .with_detail(payload)). The worker never retries on its own; the classification rides back to the workflow, which drives retries. ActivityContext exposes heartbeat(detail), attempt(), and cooperative cancellation via is_cancelled().
The full worker story (failure contract, retry semantics, protocol) lives in the repository's activities and workers guide.
See the main Aion repository at https://github.com/ablative-io/aion.