FAQ | This is a LIVE service | Changelog

Commits on Source 9

  • Hal Blackburn's avatar
    feat: implement models for GCP Pub/Sub CloudEvents · d67a79dd
    Hal Blackburn authored
    ucam_faas.gcp_pubsub provides support for parsing/validating/serialising
    GCP Pub/Sub messages within CloudEvent envelopes. This is how
    `functions_framework` exposes Pub/Sub messages to handlers when a
    CloudRun function is subscribed to a Pub/Sub queue.
    
    The module contains constants for the CloudEvent type that identifies
    message events, and Pydantic data models for the data payload of these
    events.
    d67a79dd
  • Hal Blackburn's avatar
    b8950fe4
  • Hal Blackburn's avatar
    feat: add @message_handler() decorator · 3278f332
    Hal Blackburn authored
    The decorator supports event handler functions that process message
    events (currently GCP Pub/Sub messages, wrapped in CloudEvents). The
    functions receive messages as instances of a data type they choose, that
    represents the parsed payload of the message events they subscribe to.
    
    This decorator allows event handler functions to accept message data as
    a type representing the decoded payload of a message event. For example,
    a Pydantic model representing a JSON payload.
    
    - Validating incoming message metadata envelope
    - Parsing/validating the message payload
    - Recording the message envelope metadata in the function's
      `ExecutionInfo` result
    
    Handler functions can focus on processing decoded message data payloads,
    without needing to do their own parsing and validation or event metadata
    logging/reporting.
    3278f332
  • Hal Blackburn's avatar
    feat: support parsing JSON Pubsub messages as Pydantic models · 69ec3d95
    Hal Blackburn authored
    This allows @message_handler(message_type=SomeModel) to parse a JSON
    Pub/Sub message with the SomeModel model, and have the decorated handler
    receive an instance of the model.
    69ec3d95
  • Hal Blackburn's avatar
    feat: support parsing Pubsub messages as Protobuf models · 6e6482b0
    Hal Blackburn authored
    This allows @message_handler(message_type=MyMessage) to parse a Pub/Sub
    message containing a Protobuf payload, where MyMessage is any Protobuf
    Message class generated by the protoc compiler. The decorated handler
    receives an instance of the message class.
    6e6482b0
  • Hal Blackburn's avatar
    c9c19ecc
  • Hal Blackburn's avatar
    docs: make @message_handler docstring simpler · f03a1ef2
    Hal Blackburn authored
    The doctest example we had in the @message_handler docstring was
    trying to be a representative example of a real handler function, but
    this made it less easy to understand compared to a more minimal example.
    
    We now present a basic "Hello World" type handler that does very little,
    but should do enough to communicate the basics.
    f03a1ef2
  • Hal Blackburn's avatar
    Merge branch '19-hlh-mr4-message-handler' into 'main' · 702cb926
    Hal Blackburn authored
    High-level handlers MR4: Message handlers
    
    Closes #25, #27, #28, #29, and #30
    
    See merge request !52
    702cb926
  • lib-bot's avatar
    chore(release): 0.20.0 · b3472821
    lib-bot authored
    b3472821
Loading
Loading