FAQ | This is a LIVE service | Changelog

High-level handlers MR3: CloudEvent handlers

This MR is split out from the original High-level handlers MR !25 (closed), towards uis/devops/epics#321

These MRs are chained, with each MR targeting the previous MR's branch. They either need to be merged in order, or all at once from the final one (after changing it to target main).


This MR adds support for event handler functions that process CloudEvents.

This module 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.

Issues

This MR implements #26 (closed).

Edited by Hal Blackburn

Merge request reports

Loading