with-agents

Serverless Expeditions — selected guide

Retries and Saga pattern in Workflows

Fourteen episodes on service choice, architecture, scaling, state, security, operations, and delivery

Serverless design and operations through concrete examples: choosing a runtime, ordering events, managing relational state, undoing failed workflows, protecting secrets, and deploying changes safely. The selection also includes two AI-agent examples covering tools and database access.

Google Cloud Tech 7 of 14
In this collection Browse 14 summaries 7 of 14

An order can be created successfully even when the next step—reserving the customer's credit—fails. In this May 2023 demonstration, Mete uses Google Cloud Workflows to coordinate those steps, retry temporary failures, and cancel the pending order when credit cannot be reserved.

Key points

  • Put call order in a workflow: Instead of having the order service call the customer service directly, an orchestrator calls each in sequence: create a pending order, reserve credit, then approve the order. Mete argues that separating this sequence from the services makes them less dependent on one another's implementation 00:00–02:08(opens in a new tab).
  • Retry temporary errors, not an impossible business operation: The demo applies the Workflows default retry policy to an intermittently failing HTTP call. A temporary outage may clear on another attempt; a customer with insufficient credit needs a different response because retries will not supply that credit 02:08–04:15(opens in a new tab).
  • Compensate for work already completed: The Saga pattern adds a later action that undoes an earlier one when the whole operation cannot finish. Here, failure to reserve credit cancels the pending order; success approves it. Mete calls this eventual consistency: when one database transaction cannot cover all services, later steps restore a consistent outcome rather than making every step succeed together 04:15–06:29(opens in a new tab).

Full video: https://www.youtube.com/watch?v=yqMKr37mGJw(opens in a new tab)

Search

Search field guides and resources across the site.

    Keyboard shortcuts

    Press ? to open this guide (usually Shift + /). Close it before using other site shortcuts.

    Show keyboard shortcuts
    ?
    Search site
    Ctrl + K
    Close the current dialog or menu
    Esc

    Site shortcuts are ignored while typing. Browser and extension shortcuts may take priority.