Logo van Distributed Transactions

Distributed Transactions

Community
d-padmanabhan
distributed-transactions

Designs and reviews cross-service consistency using Transactional Outbox/Inbox, Saga orchestration, Saga choreography, compensating actions, idempotency, and eventual consistency. Use when the user mentions outbox, inbox, saga, orchestration, choreography, compensation, distributed transaction, dual write, CDC relay, duplicate delivery, or cross-service workflow consistency.

Overzicht

Uitgeverd-padmanabhan
Repositoryagent-engineering-handbook
Skillnaamdistributed-transactions
Sterren
20
Forks
3
Meegeleverde bestanden
3
LicentieMIT
Links
  • Instructies in Markdown

    Het model laadt het bestand SKILL.md alleen als dat nodig is. Dat kost dus alleen tokens als een verzoek daadwerkelijk bij de skill past.

  • Werkt met elk LLM

    AI-skills bestaan uit instructies in gewone Markdown, niet uit aanbiederspecifieke code. Daardoor werken ze met GPT, Claude, Gemini, Grok of een lokaal model.

  • Meegeleverde bestanden: 3

    Scripts, sjablonen en referentiemateriaal die het model tijdens het werken kan lezen. De bestanden kunnen alleen worden gelezen en worden nooit uitgevoerd.

  • Open source

    Gepubliceerd door d-padmanabhan op GitHub. Bekijk de bronbestanden voordat je de skill installeert.

Installatie

Installeer de AI-skill Distributed Transactions in TypingMind om deze met elk LLM te gebruiken, of voeg de skill toe aan een andere agent die SKILL.md kan lezen.

1

Installeren in TypingMind

TypingMind installeert een skill rechtstreeks vanuit de GitHub-map. De app leest SKILL.md, bundelt de bijbehorende bestanden en slaat het resultaat lokaal op.

  1. Open de app en ga naar Plug-ins → Skills.
  2. Kies "Installeren via GitHub".
  3. Plak de onderstaande URL van de skillmap en bevestig.
    https://github.com/d-padmanabhan/agent-engineering-handbook/tree/main/skills/distributed-transactions
  4. Schakel de skill in voor elke chat waarin je de skill wilt kunnen gebruiken.
Plug-ins → Skills → Skill toevoegen → Via GitHub-URL. Plak vervolgens de map-URL en druk op Doorgaan.
2

Installeren in een andere agent

Elke agent die het Agent Skills-formaat kan lezen, kan deze skill gebruiken — kopieer de map naar de skillmap van die agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/d-padmanabhan/agent-engineering-handbook.git /tmp/agent-engineering-handbook
mkdir -p .claude/skills
cp -r /tmp/agent-engineering-handbook/skills/distributed-transactions .claude/skills/distributed-transactions
Start Claude Code na het kopiëren opnieuw op, zodat de nieuwe skill wordt herkend.

Gebruik deze skill in TypingMind

Schakel Distributed Transactions in voor een chat naar keuze in TypingMind en het model doet de rest. De naam en beschrijving staan in de systeemprompt. Zodra een verzoek bij de skill past, laadt het model zelf de volledige instructies. Je hoeft de skill nooit handmatig aan te roepen. Pas als het model de skill daadwerkelijk gebruikt, kost dat tokens.

Het model laadt Distributed Transactions automatisch zodra een verzoek erbij past.

Werkt met elk AI-model

AI-skills zijn gewone Markdown-instructies in plaats van aanbiederspecifieke code. Daardoor is Distributed Transactions niet gebonden aan het model waarvoor de skill is geschreven. Installeer de skill één keer in TypingMind en gebruik deze met GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama of een lokaal model dat je zelf draait — allemaal met je eigen API-sleutels.

  • Alleen geladen wanneer nodig

    De systeemprompt bevat alleen de naam en beschrijving. De instructies worden bij het eerste bijpassende verzoek opgehaald, dus een ongebruikte skill kost niets.

  • Wissel van model tijdens een chat

    Omdat de skill uit instructies bestaat en niet uit code, blijft deze werken als je van model wisselt — het volgende model leest hetzelfde SKILL.md-bestand.

Skillinstructies

Dit is de inhoud van SKILL.md die het model laadt. Lees deze vóór de installatie — een skill bestaat uit instructies die je model zal volgen.

Distributed Transactions

Use this skill when one business operation spans services, databases, brokers, or external systems and cannot rely on one local ACID transaction.

Non-Negotiables

  • Prefer one local ACID transaction when the data can remain inside one ownership boundary.
  • Every design must preserve declared business invariants across success, retries, concurrency, partial failure, compensation, and recovery. Never imply that eventual consistency or a Saga provides global ACID semantics.
  • Never implement a database write followed by direct message publication as an unprotected dual write.
  • Assume messages can be delayed, duplicated, reordered, and redelivered.
  • Make externally visible commands and consumers idempotent at the business-effect boundary.
  • Acknowledging or committing a message is not proof that the business effect occurred exactly once.
  • Compensation is a new business action, not a database rollback. It can fail and may require human resolution.
  • Persist workflow state, deadlines, attempts, and decisions durably. Do not keep authoritative Saga state only in process memory.
  • Bound retries and timeouts; quarantine poison messages and expose reconciliation paths.

Choose the Simplest Correct Pattern

  1. One service and one database: use a local transaction.
  2. Publish an event after a local state change: use Transactional Outbox.
  3. Protect a consumer from duplicate business effects: use Inbox/deduplication, a domain idempotency key, or both.
  4. A short cross-service flow with clear central ownership and complex compensation: prefer Saga orchestration.
  5. A loosely coupled event reaction with few participants and no central workflow state: choreography may fit.
  6. Many ordered steps, long waits, approvals, deadlines, or operational intervention: use a durable workflow engine or explicit orchestrator.
  7. Strong global atomicity is genuinely mandatory: reconsider service/data boundaries before reaching for distributed locking or two-phase commit.

Design Workflow

Before proposing implementation, document:

  • business invariant and consistency boundary;
  • participating services and data owners;
  • commands, events, correlation ID, causation ID, aggregate ID, and idempotency keys;
  • state machine, terminal states, deadlines, retry policy, and concurrency policy;
  • compensation for each completed step and what cannot be compensated;
  • message ordering requirements and partition/routing key;
  • duplicate, stale, late, and out-of-order handling;
  • operator visibility, reconciliation query, replay policy, and manual-resolution path;
  • schema/version evolution and deployment compatibility;
  • retention and cleanup for Outbox, Inbox, workflow, and audit records.

Do not start with a framework or broker feature. Start with invariants and failure modes.

Transactional Outbox and Inbox

Write the domain change and Outbox row in the same local transaction. A separate relay publishes pending rows and marks publication progress without assuming publish-and-mark is atomic. Give each event a stable identifier and enough routing/version metadata for deterministic handling.

Consumers must make duplicate delivery harmless. Record processed message identity in the same local transaction as the business effect where possible. A transport-level dedupe window alone is insufficient for long-lived business guarantees.

Use the Outbox and Inbox reference (${HANDBOOK_ROOT}/skills/distributed-transactions/references/outbox-inbox.md) for schema, relay, CDC, polling, retention, and recovery details.

Saga Orchestration and Choreography

Prefer orchestration when

  • the workflow has many steps, branches, waits, or deadlines;
  • compensation order matters;
  • one team owns the end-to-end process;
  • operators need one authoritative workflow state;
  • participants should not know the full process.

Prefer choreography when

  • reactions are independently valuable and loosely coupled;
  • the participant graph is small and understandable;
  • no central component needs to decide the next step;
  • event contracts and ownership remain clear without circular dependencies.

Choreography is not “no orchestration”; the emergent event graph becomes the workflow and must still be observable, versioned, bounded, and testable.

Use the Saga reference (${HANDBOOK_ROOT}/skills/distributed-transactions/references/saga-orchestration-choreography.md) for state, compensation, isolation anomalies, timeouts, and recovery.

Reliability Contract

  • Use stable operation and message identifiers generated before retries.
  • Distinguish retrying transport from retrying the business command.
  • Reject or ignore stale state transitions with an explicit version or expected-state check.
  • Serialize operations per aggregate when concurrent transitions would violate invariants.
  • Keep handlers deterministic around recorded input; isolate nondeterministic calls behind persisted results.
  • Use dead-letter handling only with ownership, alerts, replay safety, and a runbook.
  • Reconciliation compares authoritative business state to Outbox, Inbox, broker, and workflow state; it does not blindly replay everything.

Observability

Emit structured events and metrics for:

  • workflow state transitions and age;
  • relay backlog age and publish attempts;
  • duplicate and stale-message counts;
  • retry, timeout, compensation, and manual-resolution counts;
  • dead-letter depth and oldest-message age;
  • correlation and causation across every command and event.

Never log secrets or unrestricted payloads. Prefer identifiers, state, schema version, and redacted failure context.

Testing

Test failure boundaries, not only the happy path:

  • crash after domain commit but before publish;
  • publish succeeds but publication marking fails;
  • duplicate, delayed, stale, and out-of-order delivery;
  • consumer crash before and after local commit;
  • concurrent commands for the same aggregate;
  • timeout followed by a late success;
  • compensation failure and repeated compensation;
  • schema version skew during rolling deployment;
  • replay from dead-letter storage and reconciliation repair.

Use deterministic fault injection and verify durable state after each interruption.

Review Output

For a design or code review, report:

  1. Invariant and boundary
  2. Critical correctness risks
  3. Chosen pattern and why
  4. Message/workflow state contract
  5. Idempotency, ordering, timeout, and compensation behavior
  6. Recovery and reconciliation
  7. Tests and operational signals

Reject vague claims such as “Kafka guarantees exactly once” or “the Saga rolls everything back.” State the actual end-to-end guarantee and its limits.

Meegeleverde bestanden

Zolang de skill geladen is, leest het model deze bestanden als dat nodig is. Het model kan ze alleen lezen; ze worden nooit uitgevoerd.

Veelgestelde vragen

Wat doet de AI-skill Distributed Transactions?

Designs and reviews cross-service consistency using Transactional Outbox/Inbox, Saga orchestration, Saga choreography, compensating actions, idempotency, and eventual consistency. Use when the user mentions outbox, inbox, saga, orchestration, choreography, compensation, distributed transaction, dual write, CDC relay, duplicate delivery, or cross-service workflow consistency.

Waarom Distributed Transactions gebruiken in TypingMind?

Omdat je deze skill één keer installeert en met elk model kunt gebruiken. Distributed Transactions bestaat uit gewone Markdown in plaats van aanbiederspecifieke code. Dezelfde skill werkt dus met GPT-5, Claude, Gemini, Grok of een lokaal model. Ook als je midden in een chat van model wisselt, blijft de skill werken. TypingMind werkt met je eigen API-sleutels, dus je betaalt aanbieders rechtstreeks in plaats van een abonnement per gebruikersplek af te sluiten. Je skills en chats blijven in je eigen opslag.

Hoe installeer ik Distributed Transactions in TypingMind?

Open Plug-ins → Skills → Installeren vanaf GitHub in TypingMind en plak https://github.com/d-padmanabhan/agent-engineering-handbook/tree/main/skills/distributed-transactions. TypingMind leest het bestand SKILL.md, bundelt de bijbehorende bestanden en installeert het geheel als een skill die je per chat kunt inschakelen.

Welke AI-modellen kunnen Distributed Transactions gebruiken?

Elk model dat je in TypingMind koppelt. AI-skills bestaan uit gewone Markdown-instructies in plaats van aanbiederspecifieke code. GPT, Claude, Gemini, Grok en lokale modellen kunnen deze skill dus allemaal laden wanneer een verzoek erbij past.

Hoeveel AI-modellen kan ik met Distributed Transactions gebruiken?

Zoveel als je wilt. Je kunt Distributed Transactions gebruiken met elk model dat skills ondersteunt, zoals GPT, Claude, Gemini, Grok, DeepSeek, Mistral of Llama. Allemaal in TypingMind met je eigen API-sleutels.

Is de AI-skill Distributed Transactions gratis?

Ja. Deze skill is door d-padmanabhan op GitHub gepubliceerd onder de licentie MIT. Je betaalt alleen je eigen AI-aanbieder voor de tokens die je gebruikt.

Wat zijn AI-skills?

Een AI-skill is een herbruikbare bundel instructies die een AI-model leert hoe het één specifieke taak moet uitvoeren. De skill volgt het open Agent Skills-formaat: het bestand SKILL.md bevat de naam en beschrijving van de skill. Daarnaast kan de skill scripts, sjablonen of referentiebestanden bevatten die het model nodig heeft. Het model leest de instructies alleen als je verzoek bij de skill past. Een geïnstalleerde skill kost dus niets zolang deze niet wordt gebruikt.

Waarin verschillen AI-skills van plug-ins of MCP-servers?

Een plug-in of MCP-server geeft een model nieuwe tools om aan te roepen: code die ergens wordt uitgevoerd en een resultaat teruggeeft. Een AI-skill geeft het model juist kennis en een werkwijze: hoe het een taak moet aanpakken, welke stappen het moet volgen en hoe goede uitvoer eruitziet. Skills bestaan uit gewone Markdown en hebben dus geen server, API-sleutel of runtime nodig. Ze werken met elk model.

Bekijk alles

Maak nu je eigen AI-werkruimte

Schrijf je in voor onze nieuwsbrief en blijf op de hoogte van nieuwe functies en toekomstige weggeefacties 👇