> ## Documentation Index
> Fetch the complete documentation index at: https://docs.revoengine.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Local transactions and external work

> Keep related database changes atomic without holding a transaction across an external call.

Use a database transaction for local records that must commit together. An external HTTP service, user approval or file transfer cannot participate in that same atomic database commit.

## Explore the behavior

Next step

<ol />

Step  of . . .

Illustration only. Select a step to inspect it or return to the start.

## Recommended boundary

```mermaid theme={null}
flowchart TD
  A["Validate the order command"] --> B["Commit reservation and pending operation together"]
  B --> C["Dispatch external settlement separately"]
  C --> D["Confirm the receiver receipt"]
  D --> E["Record the settlement result"]
```

Keep a reconciliation path for the gap between committing local intent and dispatching work. A local commit followed by a separate enqueue is not one atomic operation merely because both calls appear in the same Component.

## Design a visible state machine

An order may move from `PENDING` to `COMPLETED` only after a confirmed external receipt. A failure can be retryable, terminal or uncertain; keep the evidence needed to make that distinction. Use a stable [idempotency key](https://docs.revoengine.com/patterns/idempotency.md) for the external operation.

Do not keep a transaction open while waiting for HTTP, an approval or a long calculation. This holds database resources and does not make the outside effect reversible.

For executable transaction syntax, see [low-code Database transactions](https://docs.revoengine.com/low-code/database.md#transactions). The [order workflow tutorial](https://docs.revoengine.com/platform/first-production-workflow.md) separates reservation and settlement into explicit stages.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.