Overview
Holds look simple from a distance. Something asks for part of a resource to be set aside, and the system that owns the resource sets it aside. Across industries the claims reduce to four verbs. Reserve sets aside a quantity: money against a balance, units against stock, minutes or megabytes against a quota, budget against an appropriation. Freeze sets aside the whole resource when no quantity is given. Restrict limits what can be done with the resource or by its owner, not how much is set aside: no outflows, no shipments, no new commitments. Release undoes what an earlier claim imposed, in full or in part.
The difficulty is never a single verb. It is the combination. Several claims from different sources can target the same resource at the same time: an order reservation, a quality quarantine and a priority-channel allocation on one stock-keeping unit; a dispute hold, a fraud block and a legal order on one account. Each can be released, reduced or reversed independently. A reversal can arrive while the original claim is still executing. And the organisation must be able to answer, at any moment and for any auditor: what is held, on which resource, because of which claim, of which type, and how much was deliberately left untouched?
That question has one architectural fork. Either the system of record — a mainframe ledger, a packaged core platform, an ERP or a billing engine — is the record of what is held, or a dedicated obligation platform is. This guide takes the second path and walks through what it costs: a ledger, a reconciler, an event store, a service-definition model and a connector contract. It builds on Event Sourcing & CQRS in Payments and does not repeat those basics. The focus here is on what changes when the aggregate is an obligation against a shared resource rather than a single transaction.
Why stacking one hold per claim fails
The default design delegates everything to the system of record. Each claim places its own hold, tagged with the claim reference. A release removes that claim’s holds. The system of record is the record and the integration layer is stateless. It is the simplest design, it passes the first round of testing, and it fails in ways that only appear in production:
- Holds are sized blind. Three claims on one resource produce three holds, each sized without knowledge of the others. When the balance or stock cannot cover all three, which one is short is decided by arrival order, not by priority, contract or law.
- Partial releases need surgery. A partial release must find the right hold and resize it. Many legacy hold primitives support only place and remove, so a partial release becomes “remove and re-place”, with a window in which the resource is free.
- Some resources cannot carry a reference. Prepaid cards, stored-value wallets, warehouse bins and quota counters often expose a hold primitive with no reference field at all. Once two claims touch one of them, nobody can tell which hold belongs to which.
- Totals are reconstructed by scanning. “How much is held across all claims for this customer, or this product?” requires walking every system of record and stitching records back to claims by hand.
- Reversal is choreography. Undoing a claim mid-execution means knowing which holds exist at this instant and which calls are in flight, then compensating each one.
| Concern | Stacked holds in the system of record | Obligation ledger |
|---|---|---|
| Accumulation across claims | Implicit; first-come, first-held | Explicit sum per resource, by type |
| Partial release | Find and resize a specific hold | Append a release; target recomputes |
| Crude legacy hold primitives | Leaks into every service | Absorbed by the reconciler and connector |
| “Why is this held?” | Manual stitching | One query against the ledger |
| Cards, wallets, bins, quotas | Second-class, often unreferenceable | Same obligation model as every other resource |
| Operational simplicity | High: no extra state | Lower: drift must be detected and healed |
The ledger loses on exactly one row, and it is worth being honest about it. It introduces a reconciliation obligation: drift between the ledger and the system of record must be detected and healed. That cost is bounded and testable. The correctness cost of stacking is neither.
The platform owns obligations. The system of record owns the resource. The ledger never holds a balance, never posts an entry and never moves funds or stock. That keeps the obligation platform out of the ledger business and leaves the financial or inventory view exactly where it was, including the view that auditors and regulators already rely on. What changes is that “why is this held?” has one authoritative answer.
Record obligations, not the resource
An obligation is the typed effect that a claim places on one resource. Types matter because they behave differently. An amount hold accumulates. A restriction does not. A protected floor subtracts. Types also let different measures coexist on one resource and be released independently: lifting a restriction must not release a reservation.
| Obligation type | Produced by | Accumulates? | Projection in the system of record |
|---|---|---|---|
AMOUNT_HOLD | Reserve with a quantity | Yes — summed per resource | One hold sized by the reconciler |
FREEZE | Reserve without a quantity | No — boolean per resource | Freeze flag or full hold, per connector capability |
RESTRICTION | Restrict | No — set of kinds per party or resource | Applied once, removed when the set is empty |
PROTECTED_FLOOR | Policy, per cycle | Renews once per cycle | Reduces the target; never projected on its own |
Release is not an obligation type. A release is an event that ends, fully or partly, the obligations an earlier claim created. The ledger records the release and the reconciler does the rest. This is the central simplification: nobody ever writes code that says “find hold X in the system of record and reduce it by Y”.
Obligations are allocated per resource. When a claim targets a party or a product rather than one specific resource, an allocation policy decides which resources carry how much: transactional balances before savings, the nearest warehouse first, a currency or unit preference, eligibility rules per resource class. Allocation is policy, so it lives in versioned configuration, not in connector code.
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "ObligationEntry",
"type": "object",
"required": ["obligationId", "claimRef", "resourceRef", "type", "status"],
"properties": {
"obligationId": { "type": "string", "format": "uuid" },
"claimRef": { "type": "string", "description": "the claim that created it" },
"resourceRef": { "type": "string", "description": "opaque, issued by the connector" },
"resourceClass": { "enum": ["ACCOUNT_BALANCE", "STORED_VALUE", "INVENTORY_LOT", "USAGE_QUOTA"] },
"type": { "enum": ["AMOUNT_HOLD", "FREEZE", "RESTRICTION", "PROTECTED_FLOOR"] },
"amount": { "$ref": "#/$defs/quantity" },
"released": { "$ref": "#/$defs/quantity", "description": "cumulative partial releases" },
"restrictionKind": { "enum": ["NO_OUTFLOW", "NO_NEW_COMMITMENT"] },
"cycle": { "type": "string", "description": "replenishment period, floor only" },
"status": { "enum": ["ACTIVE", "RELEASED"] },
"sourceEvent": { "type": "string", "description": "claimRef + sequence that produced this row" }
},
"$defs": {
"quantity": {
"type": "object",
"required": ["value", "unit"],
"properties": {
"value": { "type": "string", "pattern": "^[0-9]+(\\.[0-9]{1,3})?$" },
"unit": { "type": "string", "pattern": "^[A-Z0-9]{2,3}$",
"description": "ISO 4217 currency or UN/ECE Rec. 20 unit code" }
}
}
}
}
Every row carries sourceEvent. The ledger is itself a projection of the claim streams described below: you can drop it and rebuild it. That property is what lets you trust it as the record.
The hold as a reconciled projection
The reconciler has one job: for each resource, compute the hold that should exist and make the system of record agree. The target is one line:
heldTarget = min( netObligation, max(0, available − protectedFloor) )
netObligation is the sum of active amount holds on the resource, minus releases. protectedFloor is the part of the resource that policy, contract or law says must stay free — a protected share of income under enforcement law, safety stock kept for a priority channel, an emergency allowance on a prepaid plan — or zero when the system of record protects it natively or the claim waives it. available is the level before the platform’s own hold. Get that last detail wrong and the reconciler chases its own tail: it sees the hold it placed as missing supply and shrinks the hold on every run.
The reconciler runs on four triggers: an obligation changes; a level-changing event lands on the resource, such as a credit, a goods receipt or a quota top-up that makes more available to hold; a replenishment cycle rolls over and the floor renews; a periodic sweep checks for drift. All four call the same function. One path means one thing to test.
public final class HoldReconciler {
private final ObligationLedger ledger;
private final ConnectorRuntime connectors;
private final ProjectionStore projections; // last hold placed by the platform, per resource
private final DriftReporter drift;
public Outcome reconcile(ResourceRef res, Trigger trigger) {
LedgerView view = ledger.activeView(res); // all claims, all types
Quantity net = view.netAmountObligation();
Quantity floor = view.protectedFloor(); // ZERO if delegated or waived
HoldState sor = connectors.holdState(res); // what the system of record says exists
Quantity available = sor.availableExcludingOwnHold(); // never count the platform's own hold
Quantity target = Quantity.min(net,
Quantity.max(Quantity.ZERO, available.minus(floor)));
Projection expected = projections.get(res);
if (!sor.heldAmount().equals(expected.amount())) {
drift.report(res, expected, sor, trigger); // someone else touched it
}
if (sor.heldAmount().equals(target)) {
return Outcome.noOp(res, view.version()); // idempotent: nothing to do
}
// Key = resource + ledger version. A replay of the same version is a no-op
// at the connector; a newer version supersedes, never stacks.
IdempotencyKey key = IdempotencyKey.of(res, view.version());
CapabilityResult r = target.isZero()
? connectors.holdLift(res, key)
: connectors.holdSet(res, target, key); // place or modify
return switch (r.code()) {
case OK, ALREADY_APPLIED -> {
projections.put(res, new Projection(target, view.version()));
yield Outcome.applied(res, target);
}
case TEMPORARY -> Outcome.retryLater(res); // backoff, same key
case NOT_FOUND, PERMANENT -> Outcome.escalate(res, r); // human task
case INSUFFICIENT_AVAILABLE -> Outcome.retryOnNextLevelEvent(res);
};
}
}
Two properties matter more than the code. First, the idempotency key is the ledger version, not the claim. Ten claims on one resource produce one hold, resized ten times, not ten holds. Second, the reconciler is convergent. Run it twice, run it after a crash, run it from two pods at once behind an advisory lock per resource: the end state is the same.
The ledger is authoritative, so the reconciler drives the system of record back to target when it finds drift. But if the same resource drifts on every sweep, something outside the platform keeps changing it: a manual release, a hold expiry date in the system of record, a batch job. Re-applying forever hides that. Cap automatic re-application per resource per day, then raise a human task with the before and after. Drift that repeats is a process problem, not a reconciliation problem.
Protected floor, computed centrally
Many domains leave part of a resource deliberately untouchable. Enforcement law commonly protects a share of salary or benefits from garnishment; a retailer keeps safety stock that marketplace orders may not consume; a prepaid plan keeps an emergency allowance that no reservation can take. Mature systems of record sometimes implement the floor natively. Newer or simpler substrates — stored-value platforms, warehouse bins, quota counters — usually do not. The obligation is uniform; the substrate is not. The platform has to make the protection uniform anyway, which means the floor is computed in one place and applied through the same target formula on every resource class.
Choose one of three tiers per resource, based on what its connector declares it can do.
| Tier | When | Mechanism |
|---|---|---|
| Delegate | Connector declares nativeProtectedFloor | Pass the flag; the system of record computes and enforces. The ledger floor is zero for that resource. |
| Compute centrally | No native protection, but partialHold is supported | The platform computes the floor and the reconciler holds the net amount, renewing every cycle. |
| Gap | No partial hold, or no reliable replenishment signal | Never over-hold silently. Detect, escalate to a human carve-out, or mark the resource ineligible for amount holds while the floor applies. |
One guardrail binds all three: exactly one layer protects each resource. Native where it exists, central only where it does not. Two layers would carve the floor out twice and under-enforce the claim.
Central computation needs to know when the resource is replenished. Two sources usually exist: an authoritative batch file that states what was credited or received for which period — a payroll file, a goods-receipt load, a billing-cycle reset — and a per-resource notification that arrives faster but cannot always tell a qualifying replenishment from any other movement. Treat the file as the authority and the notification as a latency shortcut. Normalize both to one event and deduplicate on (party, resource, period). The floor then renews exactly once per cycle, whatever order the two sources arrive in, and even if one never arrives.
The critical failure is holding what must stay free. Under-enforcing a claim is an audit finding; over-holding a protected salary, or consuming the safety stock kept for priority orders, is direct harm to a customer. Ship delegate and gap first: together they guarantee no silent over-hold. Central computation is the harder engineering and can follow once the reconciler has run in production for a few cycles.
Every claim is a hash-chained stream
Each claim is an event-sourced aggregate with its own stream. Two properties go beyond a standard event store.
Gap-free sequence per claim. Each event carries a sequence number that starts at 1 and increments by exactly 1. An append succeeds only if the expected previous sequence matches, enforced by a unique constraint on (claim_id, sequence). A missing number is detectable without any other source of truth.
Hash chain. Each event stores hash = H(prevHash || canonical(event)). Altering or deleting any event breaks every hash after it. Anchor the chain head periodically to write-once storage, and an auditor can verify a claim’s full history with nothing but the stream and the anchor.
{
"claimId": "7f1c2e9a-4b8d-4f0e-9a51-1d2c3b4a5e6f",
"sequence": 6,
"type": "ObligationReleased",
"occurredAt": "2026-11-12T09:41:07.312Z",
"definition": { "service": "release", "version": "3.2.0" },
"payload": {
"releasesClaim": "claim:reserve:a",
"resourceRef": "resource:opaque:01",
"amount": { "value": "10000.00", "unit": "XXX" },
"partial": true
},
"decision": { "rule": "release.partial", "ruleVersion": "3.2.0", "inputsDigest": "sha256:9c1f…" },
"prevHash": "sha256:4e07…",
"hash": "sha256:b3a9…"
}
Note the decision block. Every event that reflects a choice records the rule, the rule version and a digest of the inputs. Replaying the same inputs against the same version gives the same outcome, which turns “why did the system do this?” from an investigation into a lookup. Encrypt personal data inside payloads at field level and hash identity keys; the chain covers the ciphertext, so a key rotation does not break verification.
public Verification verify(List<StoredEvent> stream, Anchor anchor) {
String prev = Hashes.GENESIS;
long expectedSeq = 1;
for (StoredEvent e : stream) {
if (e.sequence() != expectedSeq++) return Verification.gap(e);
if (!e.prevHash().equals(prev)) return Verification.broken(e);
String h = Hashes.sha256(prev, Canonical.json(e.withoutHash()));
if (!h.equals(e.hash())) return Verification.tampered(e);
prev = h;
}
return anchor.covers(prev) ? Verification.ok() : Verification.unanchored(prev);
}
Lifecycle and reversal from pre-terminal states
Claims follow an explicit state machine. Use the same state names in dashboards and alerts, so nobody has to reconstruct status from logs.
| State | Meaning | Can reverse? |
|---|---|---|
RECEIVED | Accepted and acknowledged | Yes |
VALIDATING | Schema and rule checks | Yes |
EXECUTING | Obligations recorded; capability calls in flight | Yes |
AWAITING_APPROVAL | Maker-checker required by policy | Yes |
COMPOSING_OUTCOME / CALLBACK_PENDING | Result assembled; reply queued in an outbox | Yes |
COMPLETED, REJECTED, DECLINED | Terminal | No — a later release is a new claim |
REVERSING → REVERSAL_COMPLETED | Compensation per the service definition | — |
A reversal can arrive at any pre-terminal state. With stacked holds that is painful. With the ledger it is short: the reversal appends ObligationReleased for every active obligation of the claim and moves to REVERSING; the reconciler recomputes the resource targets. If a capability call was mid-flight, its late reply is applied under an older ledger version and superseded on the next run. Compensation becomes data, not choreography.
Messages arrive out of order. Store a reversal for an unknown claim as a tombstone keyed by the claim reference, with a time-to-live. When the original claim arrives, it is born reversed: recorded, audited and closed without ever creating an obligation. Rejecting the early reversal instead leaves a claim that executes and is never undone.
Versioned service definitions, in-flight claims pinned
Reserve, freeze, restrict and release should not be separate code paths, and neither should each claim source. An order reservation and a quality quarantine, or a dispute hold and a legal order, are the same few shapes with different rules. They are definitions executed by one engine. The engine knows a small number of choreography templates — request with callback, request with approval, synchronous inquiry, reversal compensation — and a definition picks a template and parameterizes it. A new service adds a definition; only a genuinely new shape needs a code release.
service:
id: reserve
version: 2.4.0
choreography: request-with-approval
reversal: { supported: true, compensation: obligations.releaseAll }
sla: { replyWithin: PT15M }
validations:
- rule: "request.amount == null || request.amount.value > 0"
error: INVALID_AMOUNT
obligations: # what the claim writes to the ledger
- when: "request.amount != null"
type: AMOUNT_HOLD
allocate: policy.allocation.default
- when: "request.amount == null"
type: FREEZE
capabilities: # bound connectors must provide these
- party.resolve
- resource.list
- level.inquire
- hold.set
approval: { required: byPolicy, roles: [maker, checker] }
regression: scenarios/reserve/*.replay
Package definitions together with their schemas, outcome tables and regression scenarios into one immutable release unit. Sign it at build time, verify it on import, and promote it through environments the way you promote a container image. Most important: each claim records the definition version it started on and stays pinned to it until it reaches a terminal state. A new version changes new claims only. That removes a whole class of incident — the rule that changed under a claim already half-way through execution — and it makes every historical decision reproducible against the exact rules in force at the time.
Connector contracts, error taxonomy and certification
The engine never talks to a system of record directly. It calls capabilities, and a connector translates each capability for one system: a mainframe ledger, a packaged core platform, a card or stored-value processor, a warehouse management system, a billing engine. Connectors are thin and stateless. All claim state, and all audit, lives in the platform. Whether a connector runs as a flow on an integration server such as IBM App Connect Enterprise or as a small service on Kubernetes or Red Hat OpenShift matters less than the contract it honours.
| Capability | Shape | Contract rule |
|---|---|---|
party.resolve | identity → partyRef | The only place identity is translated |
resource.list | partyRef, filter → resources | Filter vocabulary owned by the platform |
level.inquire | resourceRef → available, total | Must expose the level excluding own hold |
hold.set / hold.lift | resourceRef, amount, key → holdRef | Replay-safe on the idempotency key |
restriction.apply / .remove | ref, kind, key → restrictionRef | Restriction kinds owned by the platform |
replenishment.inflow | events → normalized replenishment | File, notification, both or none |
Connectors return capability results, never raw system status codes. Fix the error taxonomy in the contract: NOT_FOUND, INSUFFICIENT_AVAILABLE, ALREADY_APPLIED, TEMPORARY, PERMANENT. Five values, each with exactly one engine reaction. A connector that cannot map an error to one of them has not understood the system it wraps.
Each connector ships a manifest declaring its capabilities, versions and behaviour flags such as partialHold and nativeProtectedFloor. Before a service is enabled, check that the bound connectors cover every capability its definition needs. A gap blocks activation; it never surfaces as a runtime failure on a live claim.
Certification is a contract-test suite plus a simulator scenario pack, and it must run green before a connector is bound. The scenarios that catch real defects are not the happy paths:
-
Duplicate delivery
The same
hold.setwith the same key arrives twice, ten milliseconds apart, and again an hour later. The second and third calls must returnALREADY_APPLIEDand leave exactly one hold. -
Reversal storms
Hundreds of claims on overlapping resources are reversed at once, at every lifecycle state, including mid-call. End state: every resource at its recomputed target, no orphan holds, every stream verifiable.
-
Out-of-order and superseded calls
A call under ledger version 5 completes after version 6 was applied. The connector, or the reconciler on its next pass, must leave version 6 in force.
-
Timeouts with unknown outcome
The connector times out after the system of record has applied the hold. The retry with the same key must converge, not double.
Failure modes
A system of record is upgraded and starts enforcing the floor natively, but its connector manifest still says it does not. The platform computes a floor on top of the native one and the claim is under-enforced by the full floor. Mitigation: version the manifest with the connector release, and include a certification scenario that fails if both layers protect the same resource.
A level-event storm during a bulk replenishment run — a payroll batch, a warehouse receipt load, a billing-cycle reset — triggers a reconcile per event. If the system of record is already slow, the reconciler adds load at the worst moment. Mitigation: coalesce triggers per resource over a short window, keep a circuit breaker per connector, and let TEMPORARY back off. The target is a function of state, not of the trigger, so coalescing loses nothing.
If a projection rebuild silently skips an event, the ledger under-states obligations and the reconciler releases what it should hold. Mitigation: rebuilds verify every chain first and refuse to publish a ledger version derived from a stream with a gap or a broken hash.
Some legacy hold primitives require an expiry date. If the connector sets one, the hold silently disappears while the obligation is still active, and the reconciler sees drift every time it expires. Mitigation: use the longest expiry the primitive allows, declare it in the manifest, and let the reconciler re-place before expiry rather than after.
Implementation checklist
-
Agree the ownership split in writing
The platform owns obligations; the system of record owns the resource. Record it as an architecture decision and have the business, compliance and system-of-record owners sign it. Every later argument resolves against this line.
-
Define obligation types before services
Types, accumulation rules and how each projects to each resource class. Services are then definitions that emit typed obligations.
-
Build the reconciler as a first-class component
One function, four triggers, keyed on resource and ledger version, with drift reporting and a cap on automatic re-application. Test it with property-based tests: any sequence of obligation changes must converge to the same target.
-
Make every claim stream gap-free and chained
Unique constraint on sequence, a hash per event, periodic anchors, and a verifier auditors can run themselves.
-
Ship the protected-floor gap tier first
Delegate where the system of record can, escalate where nothing can, and only then compute centrally. Never ship a path that can silently over-hold.
-
Version service definitions and pin in-flight claims
Sign, verify, promote, pin. Regression scenarios travel inside the release unit, so a definition cannot be promoted without its own tests.
-
Certify connectors on the hard scenarios
Duplicate delivery, reversal storms, superseded calls and unknown-outcome timeouts. A connector that passes only the happy path is not certified.