Expand description
Trading-partner master data — the PartnerStore trait and supporting
types.
§Why not just a HashMap<GLN, URL> in config?
The partners = ["GLN=URL", …] field in makod.toml works for
development but falls short in production:
| Requirement | Config-only | PartnerStore |
|---|---|---|
| Survives restarts without re-deployment | ❌ | ✅ |
| Carries PARTIN-derived metadata (validity, contacts, bank) | ❌ | ✅ |
| Updatable from inbound PARTIN messages at runtime | ❌ | ✅ |
| Tenant-scoped isolation | ❌ | ✅ |
| Multiple communication channels per partner | ❌ | ✅ |
| Validity windows (Gültig Ab) for future-dated updates | ❌ | ✅ |
§PARTIN data model
The German energy market uses EDIFACT PARTIN messages (PIDs 37000–37014) to distribute market-participant master data. Each PARTIN carries:
NAD→ GLN, company name, country codeCOM→ communication channels: AS4 endpoint URL, email, fax (up to 5)CCI/CAV→ availability windows (Erreichbarkeit)FII→ bank account (IBAN, BIC)RFF→ tax number, VAT IDCTA/NAD→ contact persons (Ansprechpartner)DTM→ valid-from date (Gültig Ab)CCI→ associated Bilanzkreis
PartnerRecord captures all of these fields in a form that is both
serializable to SlateDB and constructible from static config.
§Bootstrap pattern
ⓘ
// At startup — seed from makod.toml `[as4] partners` list:
for record in PartnerRecord::from_cli_pairs(&config.as4.partners)? {
store.upsert(tenant_id, &record).await?;
}
// Later — update from inbound PARTIN message:
let record = parse_partin_37001(&edifact_interchange)?;
store.upsert(tenant_id, &record).await?;
// Outbound AS4 dispatch:
let partner = store.get(tenant_id, &gln).await?
.ok_or(EngineError::partner(format!("no endpoint for {gln}")))?;
let endpoint = partner.as4_endpoint
.ok_or(EngineError::partner(format!("{gln} has no AS4 endpoint")))?;§Key schema (SlateDB)
pt/{tenant_id}/{gln} → JSON(PartnerRecord)
Both TenantId and GLN are fixed-width strings, giving a
pt/{36-chars}/{13-chars} prefix that bounds efficient per-tenant scans.
Structs§
- Communication
Channel - A single communication channel extracted from a PARTIN
COMsegment. - Contact
Person - A contact person extracted from a PARTIN
CTA/NAD/COMgroup. - Noop
Partner Store - A
PartnerStorethat never persists anything. - Partner
Record - Full trading-partner master record as stored in the
PartnerStore.
Enums§
- Market
Role - The market role of a trading partner as declared in their PARTIN message.
Traits§
- Partner
Store - Durable store for trading-partner master records.