Architecture Decision Record

ADR-0043: Producer and Consumer Integration Contract

Status: Accepted · Date: 2026-03-06

Status: Accepted

Date: 2026-03-06

Context

The BSFG ADR set defines the boundary topology (ADR-0001, ADR-0002), durability guarantees (ADR-0003, ADR-0004), replay semantics (ADR-0006, ADR-0033), message ontology (ADR-0008, ADR-0020, ADR-0021, ADR-0037), and the runtime API contract (ADR-0022). These decisions establish what BSFG guarantees and how its internal mechanisms behave.

However, application developers integrating with BSFG require an explicit contract specifying:

Without this explicit contract, integrators may incorrectly assume:

These misassumptions lead to integration defects: duplicate fact emission without stable IDs, premature business-outcome confirmation, or consumer-side processing without idempotency. An explicit integration contract removes this ambiguity.

Options Considered

Option Description Pros Cons
Implicit contract Leave emitter and consumer behavior implied by the existing ADRs.

|

| | API-only documentation | Describe only the four RPC operations — inputs, outputs, and error codes — without specifying operational obligations. |

|

| | Explicit integration contract (Selected) | Define emitter and consumer obligations normatively: required call sequences, idempotency guarantees, retry expectations, and artifact lifecycle. |

|

|

Decision

BSFG defines an explicit integration contract covering both actor roles. This contract is normative: all systems interacting with the boundary via the four RPC operations must satisfy it.

Producer (Emitter) Responsibilities

An Emitter (Producer) is any system that appends facts to a BSFG boundary node via AppendFact. Producers must satisfy the following obligations:

Required call sequence:

optional PutObject — upload artifact if referenced AppendFact — emit fact with stable message_id retry AppendFact on failure (same message_id, same payload)

Producer guarantees to the boundary:

Consumer Responsibilities

A Consumer is any system that retrieves facts from a BSFG boundary node via FetchFacts and ConfirmReceipt. Consumers must satisfy the following obligations:

Required call sequence:

FetchFacts — retrieve next batch from durable consumer position apply fact — execute idempotent business logic persist result — durably record business outcome ConfirmReceipt — advance cursor at the boundary

Consumer guarantees to the boundary:

Artifact Handling

Large binary artifacts are stored out-of-band and referenced by facts (ADR-0013, ADR-0024, ADR-0039). The artifact lifecycle spans both roles:

Producer sequence:

PutObject — upload artifact to object store AppendFact — emit fact referencing artifact by metadata

Referenced artifacts are immutable once fact-addressed (ADR-0039). A producer may not overwrite or delete an artifact that has been referenced by an appended fact.

Consumers must tolerate delayed artifact availability. Object store propagation may lag fact propagation across zones. Consumers should retry artifact retrieval before treating unavailability as a permanent error.

Delivery Semantics

The boundary provides the following transport guarantees:

Application layers must not assume exactly-once delivery. The boundary does not guarantee that a consumer processes each fact exactly once. That property is achieved by the combination of at-least-once delivery and idempotent consumer processing.

Consequences

Benefits:

Tradeoffs: