FAQ | This is a LIVE service | Changelog

Verified Commit 44ab0b74 authored by Hal Blackburn's avatar Hal Blackburn
Browse files

feat: add @cloud_event_handler() decorator

This decorator takes care of the common functionality that typical
event-handler functions need when they process CloudEvents. It provides
support for:

- Validating the type of incoming CloudEvents
- Parsing/validating the data payload of CloudEvents
- Recording the CloudEvent's metadata in the function's ExecutionInfo
  result

Handler functions can focus on processing a primary data value without
needing to do their own parsing and validation or event metadata
logging/reporting.

To use this module, handler functions are wrapped with this module's
`@cloud_event_handler(...)` decorator. The decorator takes a parser
function that is responsible for validating CloudEvent values, and
extracting their data payload.

Handler functions receive the primary value from the parser function,
and also have access to the the full CloudEvent via the
`CLOUD_EVENT_HANDLER_CONTEXT` `ContextVar`. Metadata from the CloudEvent
is automatically included in `CloudEventHandlerExecutionInfo` values
created within the handler function's scope.
parent f9c36ab4
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment