The first template of the source-aligned family: one data product per source system, capturing a database by CDC and turning what it emits into what a canonical product accepts. It runs on the Integration Bus, not in a domain, and is deployed with the `data-bus` CLI. What it produces, and what its tests hold it to: raw topics in the source's own shape; deterministic identity, so a re-snapshot upserts rather than duplicating; validation against the canonical product's rules before publishing, with what fails going to the product's own dead-letter topic with the reason; keying by the canonical identifier; provenance in headers; and an archive in the bus object store that can be replayed back onto the raw topic. The worked example captures an ERP customer table and delivers into Canonical Party in the digital-core domain: 12 smoke checks, 37 unit tests, including a poison record that is quarantined while the next record still arrives. The canonical template's topics now declare the key producers must set, which is the other half of that contract. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
83 lines
3.1 KiB
YAML
83 lines
3.1 KiB
YAML
# ERP Party: source-aligned data product manifest (worked example of the CDC template).
|
|
# Read by `uv run data-bus deploy|test|unit|register|undeploy example`, run from semprini-data.
|
|
#
|
|
# One source system, one product. It captures the ERP's customer table by CDC, keeps the
|
|
# source's own records on a raw topic, and transforms them into what Canonical Party accepts.
|
|
# Nothing here creates anything in the digital-core domain: that product's inbound topics are
|
|
# its contract, and belong to its team.
|
|
|
|
product:
|
|
name: "ERP Party"
|
|
slug: "erp-party"
|
|
class: source-aligned
|
|
system: "erp" # the source system: names the topics, the registry group and the DLQ
|
|
mechanism: cdc # this product came from source_aligned_cdc_data_product/
|
|
version: "0.1.0"
|
|
owner: "integration@example.com"
|
|
domain: "digital-core" # the catalogue domain; defaults to the first target's
|
|
|
|
capture:
|
|
connector: connectors/erp-party.json
|
|
connector_name: "erp-party"
|
|
# The real ERP is not on this machine. The fixture is a stand-in with the same table, so the
|
|
# product can be deployed and proved end to end; `data-bus fixture up example` starts it.
|
|
fixture:
|
|
compose: fixture/compose.fixture.yml
|
|
container: source-erp
|
|
user: erp
|
|
database: erp
|
|
|
|
events:
|
|
registry_group: "bus.erp"
|
|
compatibility: BACKWARD
|
|
topics:
|
|
# The source's truth, unreshaped, keyed by the source's own key and kept for replay.
|
|
- name: "raw.erp.public.customer"
|
|
role: raw
|
|
object: "public.customer"
|
|
key: "id"
|
|
schema: events/schemas/raw.erp.public.customer.json
|
|
partitions: 3
|
|
cleanup_policy: delete
|
|
retention_ms: 604800000 # 7 days
|
|
|
|
# What the transform could not turn into a canonical record, with the reason.
|
|
- name: "erp.dlq"
|
|
role: dead-letter
|
|
key: "source_key"
|
|
schema: events/schemas/erp.dlq.json
|
|
partitions: 1
|
|
cleanup_policy: delete
|
|
retention_ms: 2592000000 # 30 days
|
|
|
|
# What Kafka Connect could not read or convert at all: the original bytes, with the
|
|
# failure in the record's headers. A different shape, so a different topic.
|
|
- name: "erp.dlq.capture"
|
|
role: dead-letter
|
|
schema: events/schemas/erp.dlq.capture.json
|
|
partitions: 1
|
|
cleanup_policy: delete
|
|
retention_ms: 2592000000
|
|
|
|
transform:
|
|
job: flink/job.sql
|
|
name: "erp-party"
|
|
|
|
# Every raw record is also written to the bus object store as it streams. The raw topic is kept
|
|
# for seven days; this is kept for as long as the ERP's records have to be reproducible, and is
|
|
# what `data-bus replay` reads to put records back on the raw topic.
|
|
archive:
|
|
bucket: "raw"
|
|
path: "erp/public.customer"
|
|
format: json
|
|
replay: flink/replay.sql
|
|
|
|
targets:
|
|
- domain: "digital-core"
|
|
product: "canonical-party"
|
|
bootstrap: "kafka-digital-core:39092" # the domain's BUS listener, on semprini_bus
|
|
topics:
|
|
- name: "digital-core.canonical-party.party.inbound"
|
|
key: "party_id" # every record must be keyed by this
|
|
source: "raw.erp.public.customer"
|