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>
82 lines
3.2 KiB
YAML
82 lines
3.2 KiB
YAML
# {{product_name}}: source-aligned data product manifest.
|
|
# Read by `uv run data-bus deploy|test|unit|register|replay|undeploy <product dir>`, run from
|
|
# semprini-data. Names every part of the product the Integration Bus owns. One source system,
|
|
# one product; see README.md for how to fill this in.
|
|
|
|
product:
|
|
name: "{{product_name}}" # e.g. "ERP Party"
|
|
slug: "{{slug}}" # kebab-case, e.g. "erp-party"
|
|
class: source-aligned
|
|
system: "{{system}}" # the source system id: names topics, registry group and DLQ
|
|
mechanism: cdc # this template captures by change data capture
|
|
version: "0.1.0"
|
|
owner: "{{owner_email}}"
|
|
domain: "{{catalogue_domain}}" # the OpenMetadata domain; defaults to the first target's
|
|
|
|
capture:
|
|
connector: connectors/{{slug}}.json
|
|
connector_name: "{{slug}}"
|
|
# A stand-in for the source system, for tests only. Leave it out if the real system is
|
|
# reachable from this machine and the tests capture from it.
|
|
fixture:
|
|
compose: fixture/compose.fixture.yml
|
|
container: source-{{system}}
|
|
user: "{{source_db_user}}"
|
|
database: "{{source_db_name}}"
|
|
|
|
events:
|
|
registry_group: "bus.{{system}}"
|
|
compatibility: BACKWARD
|
|
topics:
|
|
# One raw topic per source object, in the source's own shape, keyed by the source's key.
|
|
- name: "raw.{{system}}.{{source_schema}}.{{source_object}}"
|
|
role: raw
|
|
object: "{{source_schema}}.{{source_object}}"
|
|
key: "{{source_key}}"
|
|
schema: events/schemas/raw.{{system}}.{{source_schema}}.{{source_object}}.json
|
|
partitions: 3
|
|
cleanup_policy: delete
|
|
retention_ms: 604800000 # 7 days; the archive keeps them for longer
|
|
|
|
# What the transform could not turn into a canonical record, with the reason. Required:
|
|
# a source-aligned product owns what it cannot produce.
|
|
- name: "{{system}}.dlq"
|
|
role: dead-letter
|
|
key: "source_key"
|
|
schema: events/schemas/{{system}}.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: "{{system}}.dlq.capture"
|
|
role: dead-letter
|
|
schema: events/schemas/{{system}}.dlq.capture.json
|
|
partitions: 1
|
|
cleanup_policy: delete
|
|
retention_ms: 2592000000
|
|
|
|
transform:
|
|
job: flink/job.sql
|
|
name: "{{slug}}"
|
|
|
|
# Every raw record is also written to the bus object store as it streams, so records outlive
|
|
# the topic's retention and `data-bus replay` can put them back.
|
|
archive:
|
|
bucket: "raw"
|
|
path: "{{system}}/{{source_schema}}.{{source_object}}"
|
|
format: json
|
|
replay: flink/replay.sql
|
|
|
|
targets:
|
|
# The canonical products this feeds. They belong to other teams: nothing here creates or
|
|
# changes them, and their inbound topics are their contract.
|
|
- domain: "{{target_domain}}"
|
|
product: "{{target_product}}"
|
|
bootstrap: "kafka-{{target_domain}}:39092" # the domain's BUS listener on semprini_bus
|
|
topics:
|
|
- name: "{{target_domain}}.{{target_product}}.{{target_table}}.inbound"
|
|
key: "{{target_key}}"
|
|
source: "raw.{{system}}.{{source_schema}}.{{source_object}}"
|