FAQ | This is a LIVE service | Changelog

Verified Commit f9c36ab4 authored by Hal Blackburn's avatar Hal Blackburn
Browse files

feat: add contextual_handler() decorator

Contextual event handler functions receive a primary value as an
argument, with additional context value provided to implicitly using a
`ContextVar`.

This separation allows a handler function to act primarily on an
important subset of incoming event data, but still access the wider
event metadata when needed, and automatically include metadata in
`ExecutionInfo` result values (using the `contextual_default_factory()`
pattern).

Incoming events are separated into the primary value and context value
by a parser function that receives the incoming event value from the
parent handler.

The `@contextual_handler(...)` decorator is the interface to this
functionality.
parent 08f97beb
Loading
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment