Context, State, FifoInfo¶
The typed per-invocation context, its scratch namespace, and FIFO metadata.
Context
dataclass
¶
Per-record processing context passed to handlers and middleware.
Framework-owned fields are typed, single-read-path attributes
(ctx.message_id, ctx.queue_type, ...). Arbitrary middleware/handler
scratch goes in the separate :attr:state namespace (ctx.state.foo),
so scratch can never collide with or clobber a framework field. Annotate a
handler param ctx: Context to get the typing.
eq=False gives identity semantics (cheap; avoids deep-equality over
record/lambda_context). Never deepcopy a Context — record and
the Lambda lambda_context are not safely copyable; thread the one instance.
State ¶
Mutable per-record scratch namespace for middleware and handlers.
Both ctx.state.foo and ctx.state["foo"] work (Litestar-style). This
is the ONLY writable surface for arbitrary data — framework-owned fields live
as typed attributes on :class:Context and cannot be clobbered from here.
ctx.state.foo raises AttributeError if unset; use ctx.state.get(...)
for an optional read.
FifoInfo
dataclass
¶
FIFO attributes for a record, parsed from the SQS message attributes.