processd Operator Guide
processd operator guide: NB Anmeldung STP, LF and MSB answers, the process read model and its KPIs, the NB Sperrauftrag queue, role-gated builds and Cedar.
On this page 17 sections
- Isolated shadow review
- Role isolation
- Routes and authorization
- NB module — Anmeldung STP
- NB module — EoG gap closure (§36/§38 EnWG)
- LF module — answering what the market asks a supplier
- LF module — LFN bootstrap
- Process read model
- Sperr-/Entsperrauftrag queue (NB role)
- Configuration reference
- Klärfälle
- MCP tools
- Monitoring
- MSB module — WiM MSB-Wechsel STP
- MSB module — REQOTE auto-response
- MSB module — ESA Wertebestellung (WiM Teil 2 Kap. 4)
- MSB module — §14a Steuerungsauftrag auto-ORDRSP
processd is the process decision engine. It receives the market messages
its operator must answer, walks the published
EBD
(Entscheidungsbaum) for the message's
PID, dispatches the
answer through makod before the
Frist, and queues
whatever the tree cannot decide for an operator. Beside the decisions it keeps
the process read model — one row per process, its
Antwortfrist, the per-PID KPIs and the § 7a Abs. 5 EnWG Gleichbehandlung
evidence — and, in an NB build, the
Sperr-/Entsperrauftrag queue. Terms are defined in the
glossary; which PID belongs to
which process is the process map.
graph TB
marktd["marktd :8180<br/>fan-out"]
processd["processd :8580<br/>(this service)"]
makod["makod :8080"]
pg["PostgreSQL<br/>anmeldung_decisions · abmeldeanfragen<br/>approval_queue · eog_activations<br/>neuanlage_faelle · process_projections<br/>sperr_orders"]
marktd -->|"de.mako.engine.* · de.mako.markt.versorgung.*<br/>HMAC POST /webhook"| processd
subgraph OBS ["process read model (every build)"]
PROJ["obs::project<br/>process_projections · KPIs<br/>§ 7a Abs. 5 EnWG evidence"]
PROJ --> pg
end
processd --> OBS
OBS -->|"de.mako.obs.deadline.approaching<br/>de.mako.obs.stp.parity.alert"| marktd
subgraph NB ["NB module (--features nb-only)"]
NC["mako-pruefung<br/>NB: E_0622 · E_0623 · E_0607 · E_0608 · G_0011 · G_0007<br/>LF: E_0609 · E_0624 · E_0614 · E_0615<br/>STP target ≥ 95%"]
EOG["EoG gap closure<br/>§36/§38 EnWG · §38 timer"]
SPERR["Sperrauftrag queue<br/>sperr_orders · IFTSTA 21039"]
NC --> pg
EOG --> pg
SPERR --> pg
end
subgraph LF ["LF module (--features lf-only)"]
LFA["LF answers · Strom 55007 / 55010 / 55013 / 55016 / 55607<br/>Gas 44007 / 44010 / 44013 / 44016"]
LFA --> pg
end
processd --> NB
processd --> LF
NB -->|"gpke.lieferbeginn.*<br/>gpke.lieferende.*<br/>gpke.eog.anmelden<br/>POST /api/v1/commands"| makod
LF -->|"gpke.nb-lieferende.bestaetigen/ablehnen<br/>geli.lieferbeginn.anmelden<br/>POST /api/v1/commands"| makod
NB & LF -->|"GET /api/v1/versorgung<br/>GET /api/v1/malos/{id}/grid"| marktd
Isolated shadow review
Run one review installation for a tenant, a Strom NB and a closed capture window. Give it its own database. The service imports a locally produced cohort and serves review operations. Its startup bypasses the live clients, inbound webhook, decision queues and dispatch workers. The incumbent retains custody of all market sends.
- Run the capture rehearsal with the matching
makodonPATH. Save the review on the trusted host. The fixture below is synthetic. A private capture requires the operator’s own MP-ID and independently obtained facts and expectations. - Pin the resulting file digest, scope and generation in
processd.toml. Supply the operator’s OIDC issuer, audience and explicitly appointed subjects. Start with generation 1. Restarting the same generation accepts the identical file. Install changed evidence under a greater generation. - Route the Desk’s
/svc/processd/to this installation and set"shadowReview": truein the Desk's/config.json. Wear the NB role and open System → Schattenbetrieb. Select an occurrence to see the expected and captured business fields, Prüfschritt and the request and reply digests. Enter opens the detail, Escape returns focus to the row. - To accept an incumbent error, enter a reason and a local archive reference. A separately appointed resolver confirms the decision. A corrected mako answer requires a recheck against the same request and independent expectation. A stale decision receives HTTP 412. Reload before deciding on the current evidence.
umask 077
capture=makotest/tests/fixtures/shadow
workspace=$(mktemp -d)
makotest shadow rehearse --journal "$capture/journal.json" \
--inventory "$capture/inventory.json" --mirror-root "$capture/mirror" \
--coverage "$capture/reports/complete.json" --case "$capture/case.json" \
--expected "$capture/expected.json" --makod-workspace "$workspace" \
--emit review --review-nb 9900357000003 > review.json
# 0 = agreement or empty, 1 = difference with evidence, 2 = unavailable
shasum -a 256 review.json
jq -r .scope_fingerprint "$capture/reports/complete.json"[http]
addr = "127.0.0.1:8580"
[database]
url = "env:REVIEW_DATABASE_URL"
[identity]
tenant = "stadtwerke-musterstadt"
nb_mp_ids = ["9900357000003"]
verbundene_lieferanten = []
[oidc]
issuer = "https://issuer.example.org"
audience = "processd-review"
[shadow_review]
file = "/srv/review/review.json"
sha256 = "<file SHA-256>"
scope = "<scope_fingerprint from the independent coverage report>"
generation = 1
required_werktage = 5
readers = ["nb-reviewer", "nb-resolver"]
resolvers = ["nb-resolver"]
Read the same cohort through GET /api/v1/shadow/review or get_shadow_review on /mcp. Both require a signed token for the installation's tenant, role NB and a listed subject. Only REST exposes the resolution command. The checked-in fixture yields 1 of 2 assessed, 2 without receipt timing and 0 complete Werktage. An empty interval has zero candidates. A positive readiness result requires both traffic directions, sufficient whole Werktage, every comparison and timing observation, and no open finding. The operator decides about cutover.
Role isolation
Feature flags select which decision paths compile in, so a deployment carries
only the answers its Marktrolle gives and an nb-only binary cannot answer as
an LF:
[features]
role-lf-strom = ["mako-pruefung/role-lf"] # LF answers 55007/55010/55013/55016/55607
role-lf-gas = ["mako-pruefung/role-lf"] # LF Gas 44007 / 44010 / 44013 / 44016
role-nb-strom = ["mako-pruefung/role-nb"] # GPKE STP (55001, 55077, 55004, 55600/55601), EoG closure
role-nb-gas = ["mako-pruefung/role-nb"] # GeLi Gas An-/Abmeldung STP (44001, 44004)
role-msb = ["mako-pruefung/role-msb"] # REQOTE→QUOTES, §14a ORDRSP, MSB-answered MSB-Wechsel,
# ESA Wertebestellung (35003/17007/17008/39002)
lf-only = ["role-lf-strom", "role-lf-gas"]
nb-only = ["role-nb-strom", "role-nb-gas"]
msb-only = ["role-msb"]
integrated = ["role-lf-strom", "role-lf-gas", "role-nb-strom", "role-nb-gas", "role-msb"]
The NB queue routes stay mounted in a build without an NB role, so the Cedar
decision is still the first answer; past it they answer 501 Not Implemented —
the build does not serve them, and a retry against it cannot succeed.
The flags gate handlers, not linked code: mako-gpke, mako-geli-gas and
mako-wim are unconditional dependencies. A role build cannot answer as a role
it was not built for; the §§ 6a/7/7a EnWG separation is a matter of the legal
entity and of access control, not of the binary.
PID 55016 „Kündigung" is an LF process: LFN → LFA, answered 55017/55018 under
E_0614 (Anwendungsübersicht der Prüfidentifikatoren 4.0, lfd. Nr. 20030).
Routes and authorization
Every REST route takes the Claims extractor and evaluates one
Cedar action against
services/processd/policies/processd.cedar. There is no global auth
middleware; tests/it/authorization_guard.rs checks every mounted route for a
Claims extractor and an authorization call, and holds the action sets of code
and policy to each other in both directions.
| Route | Cedar action | Granted to |
|---|---|---|
POST /webhook | — (marktd HMAC signature + timestamp) | marktd |
GET /api/v1/decisions | read-decisions | any caller of the tenant |
GET /api/v1/queue | read-queue | any caller of the tenant |
GET /api/v1/klaerfaelle · /{id} | read-case | NB, LF, MSB or ADMIN; cases kept to the caller's Marktrollen |
POST /api/v1/klaerfaelle/{id}/assign · /resolve | assign-case · resolve-case | NB, LF, MSB or ADMIN |
POST /api/v1/klaerfaelle/{id}/dispatch | dispatch-case, then decide-queue in the Freigabe's Marktrolle | NB, LF or MSB |
GET /api/v1/eog | read-eog | any caller of the tenant |
GET /api/v1/neuanlage | read-neuanlage | any caller of the tenant |
POST /api/v1/queue/{id}/approve · /reject | decide-queue | NB, LF or MSB |
GET /api/v1/counterparties · /{mp_id}/{rolle} | read-counterparty | NB, LF or MSB; rows kept to the caller's Marktrollen |
PUT /api/v1/neuanlage/{id}/identifikation | identify-neuanlage | NB |
POST /api/v1/start-supply[-gas] · end-supply[-gas] · kuendigung[-gas] | initiate-supply | LF |
GET /obs/processes · /obs/processes/{id} | read-process | any caller of the tenant |
GET /obs/kpis · GET /api/v1/audit/gleichbehandlung | read-kpi | any caller of the tenant |
GET /obs/overdue | read-overdue | any caller of the tenant |
POST /api/v1/obs/rebuild | rebuild-projection | ADMIN |
GET /obs/metrics | — (restrict at the ingress) | scraper |
GET /api/v1/sperr-orders · /{id} · /stats | read-sperr-order | NB |
POST /api/v1/sperr-orders | create-sperr-order | NB |
PUT /api/v1/sperr-orders/{id}/execute · /fail · /external-ref | execute-sperr-order | NB |
PUT /api/v1/sperr-orders/{id}/cancel | cancel-sperr-order | NB |
/api/v1/webhooks/** | manage-subscription | ADMIN |
GET /api/v1/events | read-events | ADMIN |
GET /api/v1/openapi.json | — | anyone who reaches the port |
POST /mcp | use-mcp, then a per-tool action | any caller of the tenant |
GET /api/v1/policy | read-policy | any caller of the tenant |
GET /admin/einrichtung | read-config | any caller of the tenant |
Roles come from the mako_roles JWT claim, the tenant from mako_tenant, which
must equal the deployment's own. The runner adds /health/live,
/health/ready and /metrics.
processd refuses to start without [oidc] and without [webhook] inbound_secret, and with a [sperr] erp_webhook_url but no erp_hmac_secret;
the refusal names each missing one. allow_insecure_no_auth = true accepts both, for local development (just dev runs processd on
deploy/demo/processd.toml).
NB module — Anmeldung STP
Open the Anmeldung from the NB worklist when a Tranche has an unresolved share or assignment, or one supplier’s answer could apply to several shares. A new Tranche with another pending Anmeldung also needs review. GPKE Teil 2 chapter 2.1.2, step 1, p. 19 limits the competing-registration refusal to cases 1 and 2. EBD 4.3 chapter 6.6.1, step 270, p. 76 checks for the competing Anmeldung before selecting a case.
Decision pipeline (nb_module.rs)
de.mako.engine.process.initiated
├─ Anmeldung (55001 verb. MaLo / 55077 erz. MaLo / 44001 Gas)
│ → GET marktd /api/v1/versorgung/{malo_id} → VersorgungsStatus
│ → GET marktd /api/v1/malos/{malo_id}/grid → MaloGridRecord
│ → GET marktd /api/v1/partners/{lf_mp_id} → partner_known
│ → mako_pruefung::evaluate(…) ← E_0622 / E_3005, the Vorprüfung
│ → mako_pruefung::evaluate_lieferbeginn(…) ← E_0623 / E_3007, what is answered
└─ Abmeldung (55004 Strom / 44004 Gas)
→ GET marktd /api/v1/versorgung/{malo_id} → VersorgungsStatus
→ mako_pruefung::evaluate_abmeldung(…)
Accept → anmeldung_decisions(Accept, Zustimmungscode)
[if auto_accept] → makod …bestaetigen (antwort_code, antwort_ebd)
else → approval_queue
Reject → anmeldung_decisions(Reject, Antwortcode, Prüfschritt)
→ makod …ablehnen (antwort_code, antwort_ebd, bemerkung)
Escalate → anmeldung_decisions(Escalate) → approval_queue
AnfrageErforderlich
→ INSERT abmeldeanfragen (the waiting AnmeldungAnfrage)
→ makod gpke.beendigung-zuordnung.anfragen → UTILMD 55010 to the LFA
…09:00 Uhr des 1. WT, or the LFA answers 55011/55012…
→ Gas: makod geli.beendigung-zuordnung.anfragen → UTILMD 44010
…Ablauf des 3. WT, or the LFA answers 44011/44012…
de.mako.engine.abmeldeanfrage.beantwortet
→ take abmeldeanfragen → mako_pruefung::evaluate_lieferbeginn(…)
→ the Accept / Reject / Escalate paths above
For Geschäftsvorfall 3 the NB adds the requested percentage to all confirmed shares in force on the requested day. If the total is at most 100%, the request needs no release. Otherwise the NB reviews the Direktvermarktung shares and each incumbent in the Anmeldung’s Freigabe before issuing inquiries. This also applies when one supplier holds all existing shares. GPKE Teil 2 chapter 2.1.2 step 2, p. 20 requires the Information to identify every incumbent and its share. The Desk shows the reason in the selected language and keeps the service evidence under Details.
Approved Strom notices
With auto_accept enabled, processd freezes the confirmation and incumbent notice in PostgreSQL before it acknowledges the resolving webhook. Its worker retries each unfinished command with the same tenant, parent, recipient, end date and idempotency key. A restart or delayed receipt needs no new webhook delivery.
When an approved 55001 or 55077 owes a 55037, processd saves the operator, confirmation and incumbent notice together before contacting makod. It uses the approved end date and incumbent even when the applicant has the same MP-ID. GPKE Teil 2 chapter 2.1.2 steps 2–3, pp. 20–21 and step 10, pp. 23–24 cover the old assignment. BNetzA decision
After a timeout, open the original Freigabe in the Desk or read get_queue_entry. An approved entry leaves the pending queue. Its pending_delivery value identifies the next handoff to makod. confirmation means the application still needs a command acknowledgement. supplier_notice means makod accepted the confirmation and the incumbent notice is outstanding. The periodic worker resumes that stage after restart. HTTP 202 records acceptance with work outstanding. HTTP 204 indicates completed handoff. The open Klärfall links to this read-only status. The Desk shows the most recent failed attempt and the notice’s original market deadline. Open the originating Klärfall to check delivery to each recipient.
The original Klärfall keeps the two delivery legs visible after it closes. Find it from the process by business key or original process ID in the Desk, or pass its process UUID as originating_process_id to list_klaerfaelle or GET /api/v1/klaerfaelle. On its detail endpoint or get_klaerfall, delivery_receipts.status is available when makod returns valid evidence for the intended parties. The parties field identifies the applicant and incumbent from the recorded decision even while a receipt is outstanding or the reader is unavailable. Each populated leg identifies the PID, recipient, originating event, outbox entry, transport message and receipt time. An external AS4 leg includes the signed receipt ID. A local leg records acceptance by the addressed local party. An empty leg still awaits evidence. If the reader fails, the case returns its history with status: unavailable. The Desk refreshes the evidence while you keep the case open. With a site Cedar policy, grant the principal behind processd’s makod key ReadProcess on the NB workflow gpke-supplier-change for this tenant.
For an earlier end reported by the Gas incumbent, the NB counts from receipt of the 44011 and checks the last assigned Gastag. For a switch, that Gastag may be the seventh Werktag after receipt. In the published 4 July 2016 example, the last assigned day is 13 July and the exclusive end is 14 July at 06:00. For a move-in, a retrospective correction inside six weeks also needs evidence of the metering equipment. Freigaben holds the case when the Anmeldung cannot establish that fact. A missing metering class stays unknown. See AWH GeLi Gas 1.2 chapter 1.7, pp. 16–17, chapter 2.2, p. 25 and chapter 2.5.2, steps 4–6, pp. 41–45.
On a linked Gas confirmation, makod reads the incumbent and exclusive end from the released inquiry. It validates both outgoing messages and commits the 44002, the 44037 and their history entries in one append. The outbox can deliver either leg again after interruption. The same rule applies when the incumbent and applicant share an MP-ID (AWH GeLi Gas 1.2, chapter 2.5.2, pp. 41–45). processd retains the resolving reply until makod accepts the GNB command or Freigaben stores the decision. Redelivery reuses the original receipt day and command key.
Two trees, and on an assigned Marktlokation two phases. E_0622 is a
Vorprüfung: surviving it means only that the Anmeldung is not directly
refusable. If the Marktlokation is assigned at the Zuordnungsbeginn, the NB owes
the incumbent LFA an Anfrage zur Beendigung der Zuordnung (55010) before
answering the LFN, because E_0623 Prüfschritte 20–50 read that answer (GPKE
Teil 2 Kap. 2.1.2 SD Lieferbeginn Nr. 1 Prüfschritt 4, Nr. 3). A Gas Anmeldung
44001 takes the same path with the GNB's Abmeldungsanfrage 44010 (GeLi Gas 3.0
Kap. 3.2.3; AWH GeLi Gas V1.2 Kap. 2.5.2 Nr. 3), which the LFA answers
44011/44012 by Ablauf des 3. WT nach Eingang (Nr. 4); processd never sends a
55010 for a Gas Marktlokation.
The waiting AnmeldungAnfrage is written to abmeldeanfragen before the
Anfrage goes out, so a fast loopback answer always finds it; phase two replays
the same pure evaluation with one more fact. The final incumbent reply freezes the resolution in PostgreSQL. A retry of that reply resumes dispatch or approval until processd acknowledges the durable result. The command uses the same idempotency key on every delivery.
Silence releases the Marktlokation. „Verstreicht die Frist, ohne dass eine
Antwort beim NB eingeht, gilt dies als Bestätigung nach Fall a)." A Widerspruch
other than A30 / A41 refuses the Anmeldung with E_0623 A50 / A57
(Z35 in Gas). Those two codes need a second SG4 STS+Z35 restating the LFA's
E_0624 code (GPKE Teil 2 Kap. 2.1.2 Nr. 6); processd puts it on the ablehnen
command and makod refuses to render the message without it.
Geschäftsvorfall. On 55077/55078 SG4 STS+7 DE 9013 element 3 carries
ZW0 (ganze Marktlokation), ZW1 (bestehende Tranche) or ZW2 (neu zu bildende
Tranche); E_0622 Prüfschritte 300/310 branch on it, and a message carrying
none escalates. Geschäftsvorfall 3 asks all Tranchen-LFA and decides on
arithmetic (Prüfschritte 500–540): at least one release (A53), enough
percentage (A54), and whether a residual share would stay in the NB's own
Bilanzkreis on a direktvermarktungspflichtige Marktlokation (A55 / A56).
| Geschäftsvorfall-3 detail | Behaviour |
|---|---|
| Direktvermarktungspflicht (Prüfschritt 540) | From einsd — installed capacity against the 100-kW ceiling of §21 Abs. 1 Satz 1 Nr. 1 EEG; §20 Satz 1 Nr. 3 EEG pays the Marktprämie only from a pure EE-Bilanzkreis. No register answer → escalate |
| The registered share | SG8 Produkt-Code 9991000002090, Produkteigenschaft „prozentuale Aufteilung" (Muss on GV 3). An Aufteilungsfaktor or Aufteilung auf Technische Ressourcen escalates |
| Answers | One per Tranchen-LFA before deciding; a lapsed 09:00 Frist resolves whatever is outstanding as Zustimmung; an LFA code E_0624 does not publish escalates |
Three trees, three alphabets. Strom splits into two branches that share no Antwortcode, and Gas answers from a different Codeliste:
| Anwendungsfall | Tree | „andere Anmeldung in Bearbeitung" | Fristüberschreitung | Zustimmung |
|---|---|---|---|---|
| Strom, verbrauchende / ruhende MaLo | E_0622 15–70 | A06 | A07 | A51 (E_0623) |
| Strom, erzeugende MaLo / Tranche | E_0622 220–830 | A45 | A34/A28/A29/A30/A32/A35/A44 | A58 (E_0623) |
| Gas | E_3005 / G_0011 | ZC5 | E17 | E15 (G_0012) |
| Abmeldung Strom, verbrauchende / ruhende MaLo | E_0607 10–140 | — | A02 | A11 |
| Abmeldung Strom, erzeugende MaLo / Tranche | E_0607 500–620 | — | A22 (A21 Datum) | A27 |
| Abmeldung Gas | E_3019 / G_0007 | — | E17 | E15 |
Every code is resolved through mako_pruefung::codes against the tree that
publishes it; RejectReason can only be built from a resolved entry, and
makod re-checks it at the command boundary, where the code's Cluster
decides the response PID. A Bestätigung carries a code too (SG4 STS+E01 is
Muss), so NbEntscheidung::Accept carries A51 / A58 / E15.
mako_pruefung::nb::evaluate — the Anmeldung
Strom, verbrauchende / ruhende Marktlokation (E_0622 Prüfschritte 15–70):
| Prüfschritt | Rule | On failure |
|---|---|---|
| — | MaloGridRecord exists for the MaLo | Escalate (a data gap, not a ground to refuse) |
| 15 | Vorlauffrist — one full Werktag between receipt and Zuordnungsbeginn (LFW24, all Transaktionsgründe) | Reject A07 |
| 16–28 | Ruhende Marktlokation (ZAP): verbrauchend, Kundenanlage, Netzlokationen, iMS | Reject A09 / A08 / A37 / A47 / A46; no store records these facts, so a ruhende Marktlokation escalates at 18 |
| 30 | MaLo participates in MaKo | Reject A02 |
| 50 | Neuanlage? A MaLo marktd has never seen supplied may be one | Escalate — no store records an Inbetriebnahme, so A04 is never stated |
| 60 | Bilanzierungsgebiet matches, LF in the partner directory, and a Zuordnungsermächtigung in marktd (UTILMD 55071, not ended by a 55072) covers the Anmeldung's Bilanzkreis for this LF and Bilanzierungsgebiet on the Zuordnungsbeginn (MaBiS Kap. 10.2.1) | Reject A05 — also with none on file or no Bilanzkreis in the Anmeldung; an unreadable store fails the event for redelivery |
| 70 | No other Anmeldung in Bearbeitung | Reject A06 |
A ruhende Marktlokation is not refused at 30: its Hinweis names only stillgelegte Marktlokationen and the Modell-2-Zuordnung.
Strom, erzeugende Marktlokation (Prüfschritte 220–830) asks the Neuanlage
question at 220 as above and uses A45 / A25 for the same two questions —
the Zuordnungsermächtigung at Prüfschritt 260 — then picks one of the six Vorlauffristen of
GPKE Teil 2 Kap. 2.1.1, keyed on (Geschäftsvorfall, bestehende, angemeldete Veräußerungsform). The angemeldete one is SG10 CCI+Z22; the bestehende one
and the Ausfallvergütung flag come from einsd
(GET /api/v1/anlagen/by-malo/{malo_id}/veraeusserungsform, [nb] einsd_url),
because wire code Z90 covers both Einspeisevergütung and Ausfallvergütung,
whose Fristen differ. A missing fact escalates; a CCI+Z22 code outside the
published four is dropped at ingest with a warning. The Monatserster rule rests
on § 21b Abs. 1 Satz 2 EEG 2023.
Gas (G_0011) runs the A03/A04/A16/A17 identification checks
first, then E17 Fristüberschreitung, E13 Bilanzierungsproblem and ZC5 /
Z08 for a conflicting or duplicate Anmeldung.
mako_pruefung::nb::evaluate_neuanlage — the Neuanlage, E_0608
Inbound 55600 / 55601 register a Marktlokation commissioned for the
first time. Prüfschritte 110 / 590 loop: a Marktlokation the NB cannot yet
identify is re-checked daily for 60 Werktage and only then refused A07 /
A16. processd keeps the case log neuanlage_faelle and a daily worker:
| Endpoint | Purpose |
|---|---|
GET /api/v1/neuanlage?status=offen | The Prüflauf view, with letzter_pruefungstag (a refusal is admissible only after it) and the pruefungen count |
PUT /api/v1/neuanlage/{id}/identifikation | Body {"malo_id": "…"} (nothing else, not empty): the MaLo-ID the NB matched from its NIS/GIS; the next pass walks the tree with it |
processd sends the answer with the process's id and the identified MaLo-ID.
A Bestätigung has to say how the new Marktlokation is metered and which
Messlokationen and Messstellenbetreiber it has. processd holds none of these
facts, so makod reads them from marktd, the NB's record of that Marktlokation,
on the Anmeldung's Vertragsbeginn. If marktd holds no record, makod refuses the
Bestätigung, and the NB sends it itself with gpke.neuanlage.bestaetigen. A
ZW2 55603 names its Tranche, which marktd does not supply, so the NB always
sends that one itself.
The branches share no code (A01–A09 verbrauchend, A10–A19 erzeugend).
The Vorlauffrist is measured against the Übertragungstag (GPKE Teil 1 Kap. 7
„Fristenberechnung", S. 27) — processd reads it as the Berlin day of the
CloudEvent time, which makod sets to the instant its door received the
message. The marktd feed preserves this instant. A missing or malformed occurrence time is refused. An Anmeldung received at 23:40 and evaluated after
midnight keeps its Werktag, the Abmeldung (E_0607) is judged the same way,
and a re-evaluation on day 40 reaches the verdict of day one.
mako_pruefung::nb::evaluate_abmeldung — the Abmeldung, E_0607 / E_3019
Inbound 55004 / 44004, answered 55005/55006 (44005/44006). Strom splits into two branches that share no Antwortcode:
| Prüfschritt | Rule | verbrauchend / ruhend | erzeugend |
|---|---|---|---|
| — | MaLo known to this NB, and the LF holds an assignment or a Lieferende at this date is already settled | Escalate | Escalate |
| 50 / 500+520 | Vorlauffrist — verbrauchend: one full Werktag; erzeugend: Monatserster (A21) one month ahead (A22), § 21b Abs. 1 EEG 2023 | A02 | A21 / A22 |
| 90 / 570 | Aufhebung einer zukünftigen Zuordnung (ZH2) nennt den bestätigten Zeitpunkt | A06 | A23 |
| 80 | Z41 „Ende der ESV ohne Folgelieferung" setzt eine E/G voraus, die innerhalb von 3 Monaten vor dem Endezeitpunkt begann | A05 | — |
| 100–130 / 580–610 | Kein bereits bestätigtes Lieferende zum selben Datum | A09 | A25 |
| 140 / 620 | — | Zustimmung A11 | Zustimmung A27 |
Gas (G_0007) has one code space: E17 Vorlauffrist, Z08 bereits bestätigt,
E15 Zustimmung.
Not decided automatically: Prüfschritte 10–30 (Kundenanlagen-Herauslösung, § 20
Abs. 1d EnWG / § 10c EEG) need a fact the projection does not record, so A01
is unreachable; Prüfschritt 130 / 610 asks about an earlier message's
Transaktionsgrund and escalates. Escalation is the § 20 Abs. 1 Satz 1
EnWG-safe direction: an unfounded Ablehnung binds a customer to a supplier they
have left.
STP rate and [nb] auto_accept
The target is ≥ 95 % straight-through processing on a verbrauchende Anmeldung.
A missing malo_grid record escalates; provision grid records (the NB's own
topology, not MaStR) via marktd's NB-role PUT /api/v1/malos/{malo_id}/grid.
An erzeugende Marktlokation additionally needs [nb] einsd_url; without it
every 55077 escalates. Monitor via GET /api/v1/decisions or get_stp_rate.
Keep auto_accept = false (the default; PROCESSD_NB__AUTO_ACCEPT) until grid
records cover the portfolio, the partner directory holds every expected LF
MP-ID, and one manual review cycle confirmed the codes.
Affiliate guard — § 20 Abs. 1 Satz 1 EnWG
In a vertically integrated NB+LF utility, auto-acceptance is always blocked for An- and Abmeldungen from the operator's own LF:
initiating LF MP-ID ∈ [identity] verbundene_lieferanten ∪ lf_mp_ids
→ initiator_is_affiliate = true
auto_accept overridden to false
→ approval_queue (operator review)
The NB module answers only an An- or Abmeldung addressed to one of
[identity] nb_mp_ids — each Marktrolle and Sparte has its own Codenummer
(Allgemeine Festlegungen 6.1d Kap. 2.13), so a message to the operator's LF or
MSB code is not the NB's. Startup refuses an entry that is no 13-digit MP-ID or
that two role lists share, and warns on a GS1 GLN. The flag lands on every anmeldung_decisions row and on the read model's
ProcessProjection; see the Gleichbehandlung parity report.
Selbstzahler — the Lieferantenwechsel carve-out
GPKE Teil 1 (BK6-24-174 Anlage 1a), Vorbemerkung: „Ist der Letztverbraucher selbst Netznutzer, so tritt er in die Rolle des Lieferanten i.S. dieser Prozessbeschreibung […]. Eine Ausnahme bilden die Meldungen des Lieferanten im Rahmen des Lieferantenwechsels."
processd reads the Netznutzungsvertrag in force the day before the requested
Zuordnungsbeginn (GET /api/v1/nb-contracts/by-malo/{malo_id}?on=) and holds
the decision for the operator when it displaces a Selbstzahler:
transaktionsgrund == "E03" (Wechsel)
∧ incumbent netznutzer_typ == LETZTVERBRAUCHER
→ approval_queue (operator review), Antwortfrist attached
An Einzug (E01, E02) stays automated and skips the lookup.
NB module — EoG gap closure (§36/§38 EnWG)
Every consuming Marktlokation must be assigned to a Bilanzkreis at all times (GPKE Teil 2 Kap. 2.3). The EoG module closes supply gaps:
de.mako.markt.versorgung.gap-detected (marktd: an interval no supplier
│ covers — a Lieferende the successor
│ does not follow on, or a Fall-b
│ Bestätigung 55002/55078/44002)
├─ record case in eog_activations (idempotent per MaLo)
├─ [eog.auto_activate] GET /api/v1/grundversorger/{nb_mp_id}?sparte=…
│ └─ found → Strom: gpke.eog.anmelden → UTILMD 55013;
│ Gas: geli.eog.anmelden → UTILMD G 44013 → makod → E/G
│ (the command names MaLo, E/G, dates and Grund; makod reads the
│ Marktlokation's Stammdaten from marktd and refuses the command
│ naming what marktd does not hold)
│ (Zuordnungsbeginn = day after Lieferende — retroactive allowed;
│ Gas Bilanzierungsbeginn = Zuordnungsbeginn, GeLi Gas 3.0 Kap. 3.3.1)
│ └─ missing → case stays `detected`; operator provisions the
│ §36 Abs. 2 Feststellung and re-triggers
└─ de.mako.markt.versorgung.eog-begonnen → case `active`
(eog_art = Ersatz-/Grundversorgung as classified by the E/G in 55014;
eog_seit = Zuordnungsbeginn)stateDiagram-v2
[*] --> detected: gap-detected (uncovered interval)
detected --> detected: Grundversorger missing (operator provisions §36 Abs. 2)
detected --> angemeldet: eog.anmelden → UTILMD 55013 / G 44013
angemeldet --> active: E/G Bestätigung 55014 (eog-begonnen)
angemeldet --> detected: E/G Ablehnung 55015 (EBD E_0615)
active --> expiring: §38 timer, warn_days_before_expiry ahead
expiring --> expired: three-month maximum reached (§38 Abs. 4 S. 1)
active --> [*]: Grundversorgung (no statutory maximum)
expired --> [*]: operator follow-up (Grundversorgung regime / vertragliche Ersatzbelieferung / Anschlussunterbrechung)
A daily worker enforces the three-month maximum (§38 Abs. 4 S. 1 EnWG, calendar
months from eog_seit): warn_days_before_expiry ahead the case turns
expiring, at expiry expired; both enqueue
de.mako.markt.versorgung.ersatz-auslaufend in the transaction that moves the case,
delivered to [eog] notify_webhook_url with retry. After
expiry, Haushaltskunden pass into Grundversorgung without a market message;
otherwise the NB secures the Bilanzkreis (vertragliche Ersatzbelieferung, STS
E06) or interrupts the Anschlussnutzung. Cases are listed by
GET /api/v1/eog?status=detected|angemeldet|active|expiring|expired.
LF module — answering what the market asks a supplier
| Sparte | Inbound | Process | EBD | Answers | Frist |
|---|---|---|---|---|---|
| Strom | 55007 | Lieferende von NB an LF | E_0609 | 55008 / 55009 | 05:00 Uhr des 1. WT nach dem ÜT |
| Strom | 55010 | Beendigung der Zuordnung | E_0624 | 55011 / 55012 | 09:00 Uhr des 1. WT nach dem ÜT |
| Strom | 55013 | Anmeldung E/G (§ 36 / § 38 EnWG) | E_0615 | 55014 / 55015 | 15:00 Uhr am ÜT, sonst 15:00 Uhr des 1. WT |
| Strom | 55016 | Kündigung (LFN → LFA) | E_0614 | 55017 / 55018 | Ablauf des 1. WT nach dem ÜT |
| Strom | 55607 | Ankündigung Zuordnung LF (erz. MaLo / Tranche) | E_0603–E_0606 | 55608 / 55609 | 15:00 Uhr am ÜT, sonst 15:00 Uhr des 1. WT |
| Gas | 44007 | Lieferende von NB an LF | E_3002 | 44008 / 44009 | Ablauf des 3. WT |
| Gas | 44010 | Beendigung der Zuordnung | E_3020 | 44011 / 44012 | Ablauf des 3. WT |
| Gas | 44013 | Anmeldung E/G | E_3008 | 44014 / 44015 | Ablauf des 2. WT |
| Gas | 44016 | Kündigung beim Altlieferanten | E_3001 | 44017 / 44018 | Ablauf des 3. WT |
For the two „am ÜT" rows GPKE Teil 2 (Kap. 2.3.2.2 resp. Kap. 2.4.2.2) states two
windows depending on whether the Zuordnungsbeginn lies in the future.
mako-fristen publishes the same-day instant, rolling to 15:00 on the next
Werktag when that instant is already past, after the cut-off or on a
non-Werktag.
The same process carries the same command name in both Sparten —
{gpke,geli}.nb-lieferende.*, {gpke,geli}.beendigung-zuordnung.*,
{gpke,geli}.kuendigung.*.
How a decision is made
de.mako.engine.process.initiated (an answerable PID)
→ LfAnfrage from the CloudEvent — Transaktionsgrund and its Ergänzung
(ZW3/ZW4/ZW5/ZAP, which selects the tree's branch), Termin, ÜT
→ LfVertragslage from marktd (supply state) + vertragd (contract state)
→ pruefe_*(…)
Antwort → makod command carrying the Antwortcode and its EBD
Eskalation → approval_queue, naming the Prüfschritt it stopped at
The Antwortcode's Cluster selects the answer PID: A36 „Vertragsverhältnis
wurde beendet" rides 55011, A35 „Es besteht eine Vertragsbindung" 55012.
Two facts come from the message itself:
- Object of the Vorgang —
SG4 STS+7DE 9013 element 3:ZW3erzeugende,ZW4verbrauchende,ZW5Tranche,ZAPruhende Marktlokation. The halves ofE_0609andE_0624answer from different code ranges, so a missing Ergänzung escalates. The same element carriesZW0–ZW2on a 55077 andZW8–ZX1on a 55607; the PID decides which code space applies. - Vorlauffrist (
E_0609Prüfschritt 40,E_3002E17) —mako_fristen::abmeldungper GPKE Teil 2 Kap. 2.5.2 Nr. 1: a calendar month for EEG-Marktlokationen, the day before the last Werktag otherwise. An erzeugende Marktlokation escalates unless the deployment can say which applies.
55607: silence is not a lapse. GPKE Teil 2 Kap. 2.4.2.2 Nr. 3 has the NB assign
the supplier „aufgrund fehlender Antwort" with the Bilanzkreis on file. The
substance of the answer is that Bilanzkreis (A01 / A99 are the only codes).
UTILMD AHB Strom 2.2 Bedingungen [161]–[164] map ZW8–ZX1 onto
E_0603–E_0606. The BK rides SG8 SEQ+Z79, Produkt-Code 9991000002082,
Merkmalswert in SG10 CAV+ZV4 (the AHB admits SG4 FTX+ACB on the 55609
only, Bedingung [48]).
[[lf.bilanzkreise]] is keyed on the Sparte and the
Bilanzierungsgebiet because MaBiS (BK6-24-174 Anlage 3) Kap. 10.2.1 grants the Zuordnungsermächtigung
„je ZRT, BG, BK und LF"; several BKs for one regime are an operator choice. A
lookup reads only the rows of the answer's Sparte, the fallback row included,
so a supplier of Strom and Gas never names one Sparte's Bilanzkreis on the
other's message. Startup refuses two rows for one Sparte and
Bilanzierungsgebiet, and an eeg or kwkg list on a Gas row.
Contract facts
| Prüfschritt | Question | Source |
|---|---|---|
E_0624 5 | Ging die Anfrage bis 07:00 Uhr des nächsten WT ein? | SG4 DTM+154 on the message |
E_0624 20 | Besteht zum Folgetag noch eine Zuordnung? | marktd |
E_0624 50 | Ist der Kunde aus der Anfrage identisch mit dem Kunden beim LFA? | SG12 NAD+Z09, compared by vertragd |
E_0624 60 | Hat der LFA Informationen, dass sein Kunde nicht ausgezogen ist? | vertragd |
E_0624 90 / 220 | Bleibt das Vertragsverhältnis zum Folgetag bestehen? | vertragd — kuendigung_zum and vertragsende, whichever cuts first |
E_0614 40 / 50 / 80 | Wurde der Vertrag bereits gekündigt, und zu welchem Datum? | vertragd — kuendigung_zum only |
E_0614 70 / 580 | Ist der Vertrag zum Kündigungstermin kündbar? | vertragd — naechstmoeglicher_kuendigungstermin ≤ Termin |
E_0614 500 | Liegt zu dem genannten Objekt ein Vertrag vor? | vertragd — a contract row |
E_0609 40 | Wurde die Vorlauffrist eingehalten? | mako-fristen |
E_0615 20 | Liegt die MaLo im Grundversorgungsgebiet des Empfängers? | [lf] grundversorgungs_netzgebiete |
E_0615 30 | Wurden die Fristen zur Anmeldung eingehalten? | mako-fristen — GPKE Teil 2 Kap. 2.3.2.2 Nr. 1: a Zuordnungsbeginn in the future takes 00:00–13:00 Uhr of the letzter WT before it; one not in the future („unverzüglich") escalates. The Gas Codeliste E_3008 publishes no such step |
E_0615 50 | Besteht eine gesetzliche Pflicht zur Grund- oder Ersatzversorgung? | marktd — „nein" when another LF holds the MaLo; „ja" (§ 38 Abs. 1 EnWG) for a MaLo in Niederspannung/Niederdruck in a declared Netzgebiet that no other LF holds at the Zuordnungsbeginn; E06 / ZZD (bilateral) escalate |
Prüfschritt 50 compares names, not strings: processd forwards NAD+Z09 as
?kunde= and vertragd matches token sets; a shared Nachname alone is
Unklar and escalates (see vertragd). Without
[vertragd] url every contract fact is Bekannt::Unbekannt and a decision
reaching one escalates. auto_respond = false means an operator decides: the
walk still runs and its outcome is queued with the Antwortfrist.
The E/G Anmeldung has its own switch
E_0615 / E_3008 is the only Anmeldung whose Zustimmung accepts a statutory
duty (§ 36 / § 38 EnWG), so dispatch needs [lf] eog_auto_respond = true on
top of auto_respond. An empty grundversorgungs_netzgebiete escalates every
55013 / 44013. A Zustimmung also carries facts of the supplier's own:
| Answer | Fact | Source |
|---|---|---|
| 55014 | Versorgungsart SG10 CCI+Z36 (ZC9, ZD0, ZE3) | [lf] eog_versorgungsart |
| 55014 / 44014 | Bilanzkreis (SG8 SEQ+Z79 / SG10 CCI+Z19) | the one standard entry of the answer's Sparte in [[lf.bilanzkreise]] for the Marktlokation's Bilanzierungsgebiet, else that Sparte's fallback row's |
| 44014 | Abrechnungsintervall des LF SG6 DTM+Z20 | [lf] eog_abrechnungsintervall_monate |
| 55014 | Grundlage nach EnFG SG8 SEQ+Z75 CCI+Z61 and, beside ZF9, the Grund der Privilegierung SG10 CAV | the operator, on the decision |
The 44014 carries no CCI+Z36 and both of its facts are Muss (UTILMD AHB Gas
1.2 Kap. 5.9). The 55014's Grundlage nach EnFG is Muss too (UTILMD AHB Strom
2.2 Kap. 8.6, S. 138–139), and it is a fact about the Kunde — whether he meets
an EnFG privilege's prerequisites — that no Festlegung fixes for the supplier,
so it has no setting: every Strom E/G Zustimmung is queued for the operator to
state it. A fact that does not resolve queues the answer with its Frist and
the fact named.
eog_auto_respond = true in a Gas build without
eog_abrechnungsintervall_monate is refused at startup.
A queue entry for an
E/G Anmeldung starts its Bestätigung from the facts that resolved, frozen; the
view lists the rest in fakten_freigeben / fakten_ablehnen, and the operator
states them on the decision as bilanzkreis, versorgungsart (ZC9, ZD0,
ZE3), abrechnungsintervall_monate (1, 3, 6, 12) or enfg — ZG0, ZG1, or
ZF9+<Grund> with the Grund ZU5…ZV3, sent to makod as enfg_grundlage and
enfg_grund (the Grund rides only beside ZF9, Bedingung [463]). A value the segment does
not admit, a fact the command does not carry, and a fact replacing a frozen one
are 422.
Approval queue
The queue is shared by every compiled role. Each entry stores the makod
command for approve and for reject, resolved at enqueue, and the bodies:
| Entry | Approve sends | Reject sends |
|---|---|---|
A held decision (auto_accept / auto_respond off, a § 20 EnWG affiliate, a Selbstzahler) | the answer the automatic path would have sent, frozen at enqueue (answer_payload) | the other command, with the operator's Antwortcode |
| An escalation | the operator's answer | the operator's answer |
What an answer is addressed by (the MeLo of a WiM order, the tx_id of a § 14a
Steuerungsauftrag, the location and Messprodukt of an ESA order) is frozen on
both (answer_payload, reject_payload). The operator states the rest:
{ "antwort_code": "A01", "antwort_tree": "E_0622", "antwort_codeliste": "E_0622", "bemerkung": "…" }
An E/G Bestätigung adds the facts its entry lists as missing (bilanzkreis,
versorgungsart, abrechnungsintervall_monate, enfg).
The body is optional and refuses unknown keys. A field the frozen answer
already holds cannot be replaced (422): an approval sends the answer that was
shown. Every queueable command has an answer contract (ANSWER_CONTRACTS in
src/pg/approval.rs) naming the fields makod needs; a decision missing one is
422 with the claim released, before anything is sent. cargo xtask check-approval-commands refuses an enqueue site naming a command without a
contract.
Each entry records the Entscheidungsbaum its module decided with
(ablehnung_ebd) — the NB the tree its walk stopped in, the LF and ESA the
tree of the process, the MSB mako_pruefung::msb::baum — and none where the
answer carries no code (ESA Werteanfrage refusal, REQOTE, § 14a
Steuerungsauftrag).
A stated antwort_code must come from that tree, in the cluster the answer
sends: Zustimmung for an escalated approval, Ablehnung for a refusal, the
other cluster when rejecting overrides a held answer. Anything else is 422
with the claim released. The Freigabe view offers codes by the same rule.
The ESA Werteanfrage dispatches its refusal only; its Angebot goes through the
makod command API.
expires_at is the business Frist from mako_fristen::antwort less one hour:
| Trigger | Frist | Source |
|---|---|---|
| GPKE Anmeldung 55001 / 55077 | 11:00 Uhr des 1. WT nach dem ÜT | BK6-24-174 Teil 2, SD Lieferbeginn 5/6 |
| GPKE Abmeldung 55004 | 06:00 Uhr des 1. WT nach dem ÜT | BK6-24-174 Teil 2, SD Lieferende von LF an NB 2/3 |
| GPKE LF answer 55007 | 05:00 Uhr des 1. WT nach dem ÜT | BK6-24-174 Teil 2, SD Lieferende von NB an LF 2 |
| GPKE LFA answer 55010 | 09:00 Uhr des 1. WT nach dem ÜT | BK6-24-174 Teil 2, SD Lieferbeginn 4 |
| GPKE LFA answer 55016 | Ablauf des 1. WT nach dem ÜT | BK6-24-174 Teil 2, SD Kündigung 2 |
| GeLi Gas LF answer 44007 | Ablauf des 3. WT | AWH GeLi Gas 2.0 Kap. 2.3.2 Nr. 2 |
| GeLi Gas LFA answer 44010 | Ablauf des 3. WT | AWH GeLi Gas 2.0 Kap. 2.5.2 Nr. 4 |
| GeLi Gas LFA answer 44016 | Ablauf des 3. WT | GeLi Gas 3.0 Kap. 3.1 |
| GeLi Gas Anmeldung 44001 | Ablauf des 4. WT nach Eingang | BK7-24-01-009 Kap. 3.2.3 |
| GeLi Gas Abmeldung 44004 | Ablauf des 3. WT nach Eingang | BK7-24-01-009 Kap. 3.2.2 |
| WiM MSB-Wechsel 55039 / 55042 / 55051 / 55168 | 3 / 5 / 7 / 1 WT | WiM Strom Teil 1 |
| GPKE Neuanlage 55600 / 55601 | 00:00 Uhr des 61. WT nach dem ÜT | BK6-24-174 Teil 2 Kap. 2.2.2 (60 WT täglicher Prüflauf, E_0608) |
| GPKE Sperr-/Entsperrauftrag 17115 / 17117 / 39000 | spätester ÜT ist der 1. WT nach dem ÜT | BK6-24-174 Teil 2 Kap. 3.5.1.2 / 3.5.2.2 / 3.5.3.2 Nr. 2 |
| GPKE Anfrage Sperrung an den MSB 17116 | 3. WT nach dem ÜT — Fristverstreichen gilt als Zustimmung | BK6-24-174 Teil 2 Kap. 3.5.1.2 Nr. 4 |
| GPKE Teil 4 Stammdaten-Rückmeldung 55109 / 55230 / 55557 / 55639–55643 / 55693 | 2. WT nach dem ÜT | BK6-22-024 Anlage 1d (GPKE Teil 4) Kap. 1.4.3 / 1.4.4 Nr. 2 |
| GPKE Teil 2 Bearbeitungsstand Abrechnungsdaten 55156 / 55220 / 55673 | 2. WT nach dem ÜT | BK6-24-174 Teil 2 Kap. 3.1.1.2 / 3.1.2.2 / 3.1.3.2 |
The 45-minute APERAK window is a separate clock, owned by makod.
GET /api/v1/queue → list entries, the earliest expires_at first
POST /api/v1/queue/{id}/approve → dispatch the approve command via makod, mark Approved
POST /api/v1/queue/{id}/reject → dispatch the reject command via makod, mark Rejected
A decision may carry an Idempotency-Key (the Desk sends one with every
held decision), as may POST /api/v1/klaerfaelle/{id}/dispatch: a resend with
the same key and request is answered with the first answer and dispatches
nothing again, the same key on another entry or body is 422 idempotency_key_reuse, and one whose first request is still being decided is
409 idempotency_request_in_flight. A first request that fails with a 5xx
keeps no record, so its retry decides again. Without the key a resend meets
the Pending claim and is 409 already_decided.
Each entry also stores its proposal: vorschlag_quelle (the enqueuing rule,
{"art":"regel","name":"nb-module"}) and vorschlag_sha256, the SHA-256 of
the RFC 8785 canonical {command, body} an approval would send with no
operator input — null for an escalation. A decision is dispatched to makod
with Mako-Akteur: {"principal": <decided_by>, "vorschlag": …, "unveraendert": …}; unveraendert is true exactly when the dispatched command and body hash
to vorschlag_sha256. This is the one definition of „Freigabe unverändert"
the KPI report counts. makod accepts the header because processd's key holds
Cedar ActOnBehalf ([authz] act_on_behalf = ["processd"]), which also makes
every command processd sends on its own the system's act. The claim also
stores gesendet_sha256, the same hash of what the decision dispatched, which
get_queue_entry returns: agentd reads a proposal's fate off it, against the
body_sha256 its Prüfvermerk was taken for.
The handlers claim the entry (status = 'Pending' guard) before
dispatching and release the claim if the body is incomplete or the dispatch
fails, so a decided entry never re-sends and two operators cannot send both
answers. A decision on an entry somebody else decided first is a 409
with code already_decided and the entry's status, decided_by and
decided_at, so the second operator learns who answered and when. decided_by records the deciding principal's sub. A task running
every 60 s marks stale entries Expired; expired entries log a WARN and are
reconciled manually.
LF module — LFN bootstrap
Strom: POST /api/v1/start-supply
Initiates a GPKE Lieferbeginn (UTILMD 55001) with LFW24 Vorlauffrist validation.
curl -X POST http://processd:8580/api/v1/start-supply \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{"malo_id": "51238696012", "lieferbeginn_datum": "2026-10-01",
"transaktionsgrund": "E03", "bilanzkreis": "11XBK-STD------Y",
"haushaltskunde": true, "enfg_grundlage": "ZG1",
"kunde": {"nachname": "Mustermann", "anschrift": {"strasse": "Hauptstraße",
"hausnummer": "1", "postleitzahl": "50667", "ort": "Köln", "landescode": "DE"}}}'| Field | Required | Notes (UTILMD AHB Strom 2.2 Kap. 8.2) |
|---|---|---|
malo_id | ✓ | 11-digit Strom Marktlokations-ID |
lieferbeginn_datum | ✓ | ISO-8601 date (YYYY-MM-DD) |
transaktionsgrund | ✓ | SG4 STS+7 — E01 Ein-/Auszug (Umzug) or E03 Wechsel, the two codes the column admits (S. 73); any other is TRANSAKTIONSGRUND_UNZULAESSIG |
bilanzkreis | ✓* | SG8 SEQ+Z79 Produktpaket, Produkt-Code 9991000002082 |
haushaltskunde | ✓ | SG8 SEQ+Z01 CCI+++Z15/Z18 Gruppenzuordnung (S. 83) |
enfg_grundlage | ✓ | SG8 SEQ+Z75 CCI+Z61 — ZF9, ZG0, ZG1 (S. 85) |
enfg_grund | with ZF9 | SG10 CAV — ZU5 … ZV3, beside ZF9 only |
kunde | ✓ | SG12 NAD+Z09 Kunde des LF and NAD+Z04 his Korrespondenzanschrift — name, Straße, Ort, PLZ, Ländercode (S. 86) |
A missing Kunde fact is a 422 with code ANMELDEDATEN_UNVOLLSTAENDIG
naming each in fehlend; one the column cannot carry is
ANMELDEDATEN_UNGUELTIG with maengel. The body processd forwards is makod's
door type mako_markt::commands::GpkeLieferbeginnAnmelden.
* Optional only where the Strom fallback row of [[lf.bilanzkreise]] declares
exactly one standard entry (the Gas Anmeldung reads the Gas row). UTILMD AHB Strom 2.2 Kap. 5.3 makes the Produktpaket Muss on a 55001, so
a request resolving to none is a 422 with code MISSING_BILANZKREIS.
Every refusal is the shared problem body — error, detail (the sentence) and
code (the machine-readable reason: MISSING_MALO_ID, MISSING_LIEFERBEGINN,
TRANSAKTIONSGRUND_UNZULAESSIG, ANMELDEDATEN_UNVOLLSTAENDIG,
ANMELDEDATEN_UNGUELTIG, MISSING_BILANZKREIS, INVALID_DATE, RETROACTIVE_DATE, VORLAUFFRIST_VIOLATION, and for Gas
MISSING_ZAEHLPUNKT, MISSING_PROCESS_DATE). Each supply body is a fixed
struct: a key it does not declare is a 422 with code unknown_field and its
paths, a mandatory key left out is a 422 whose detail names the missing
field, and a mandatory key sent as an empty string is the MISSING_* refusal. A command makod refuses in the
process's current state is a 409; makod failing or unreachable is a 502
whose body names upstream and an error_id, never makod's own text.
Vorlauffrist (BK6-24-174 GPKE Teil 2, SD Lieferbeginn Prozessschritt 1):
„Spätester ÜT ist der Tag vor dem letzten WT vor dem Zuordnungsbeginn" —
day-granular, no time-of-day cutoff. The earliest Lieferbeginn is the calendar
day after the next Werktag after today (Berlin date); a date before today is
RETROACTIVE_DATE, a date before the earliest VORLAUFFRIST_VIOLATION, which
carries earliest_lieferbeginn and berlin_date. On the same Berlin day, resubmit that date in lieferbeginn_datum. The 202 carries
vorlauffrist.earliest_allowed and vorlauffrist.berlin_date_at_submission.
Gas: POST /api/v1/start-supply-gas
Initiates a GeLi Gas Lieferbeginn (UTILMD 44001). The body carries the
Lieferant's contract facts the Anmeldung NN makes Muss (UTILMD AHB Gas 1.2
Kap. 5.6); vertragd sends them from the supply contract.
curl -X POST http://processd:8580/api/v1/start-supply-gas \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"malo_id": "51238696012",
"process_date": "20261201",
"transaktionsgrund": "E03",
"bilanzkreis": "9870000000006",
"abrechnungsintervall_monate": 12,
"haushaltskunde": true,
"netznutzungsvertrag": "LIEFERANT_NB",
"netznutzung_zahler": "LIEFERANT",
"gemeinderabatt_prozent": "0",
"kunde": { "vorname": "Erika", "nachname": "Mustermann",
"anschrift": { "strasse": "Hauptstraße", "hausnummer": "1",
"postleitzahl": "50667", "ort": "Köln", "landescode": "DE" } },
"ablesekarte": { "vorname": "Erika", "nachname": "Mustermann",
"anschrift": { "strasse": "Hauptstraße", "hausnummer": "1",
"postleitzahl": "50667", "ort": "Köln", "landescode": "DE" } }
}'| Field | Required | Segment (UTILMD AHB Gas 1.2 Kap. 5.6) |
|---|---|---|
malo_id | ✓ | SG5 LOC+172 under IMD++Z36+Z12 (S. 44, 46); supplied by the ERP |
process_date | ✓ | SG4 DTM+92, YYYYMMDD (CET/CEST) |
transaktionsgrund | ✓ | SG4 STS+7 — a code the 44001 column admits (S. 45), read from the profile in force |
bilanzkreis | ✓* | SG10 CCI+Z19 (S. 50) — Gas has no Produktpaket |
abrechnungsintervall_monate | ✓ | SG6 DTM+Z20 — 1, 3, 6 or 12 (S. 48) |
haushaltskunde | ✓ | SG10 CCI+++Z15/Z18 Gruppenzuordnung nach EnWG (S. 51) |
netznutzungsvertrag | ✓ | CAV+Z74 — LIEFERANT_NB (Z09) or KUNDE_NB (Z08) (S. 52) |
netznutzung_zahler | ✓ | CAV+Z73 — LIEFERANT (Z11), or KUNDE (Z10) beside KUNDE_NB only ([216]) |
gemeinderabatt_prozent | ✓ | SG8 SEQ+Z12 QTY+Z16 — 0 to 10, two Nachkommastellen (S. 55) |
kunde | ✓ | SG12 NAD+Z09 and NAD+Z04 Korrespondenzanschrift (S. 63–64) |
ablesekarte | ✓ | SG12 NAD+Z05 Name und Adresse für die Ablesekarte (S. 65) |
* Same fallback as Strom. A process_date that is not a YYYYMMDD date is
INVALID_DATE. Every missing fact is named in one 422
ANMELDEDATEN_UNVOLLSTAENDIG (fehlend), a value the column cannot carry in
ANMELDEDATEN_UNGUELTIG (maengel), and a Transaktionsgrund outside the column
— e03 included — in TRANSAKTIONSGRUND_UNZULAESSIG (zulaessig). The body
forwarded to makod is mako_markt::commands::GeliLieferbeginnAnmelden. A
Lieferantenwechsel (E03) needs ten full Werktage between the day of submission and the first day of supply. In the published example, receipt on 4 July 2016 allows supply from 19 July. HTTP 422 returns earliest_lieferbeginn in ISO format. Resubmit it as process_date in YYYYMMDD. A move-in proceeds with a reminder to check the confirmed date if hourly balancing applies (AWH GeLi Gas 1.2, ch. 1.7 pp. 16–17, ch. 2.5.2 step 1 pp. 38–39, ch. 5.2 p. 122). The GNB answers 44002 / 44003 by Ablauf des 4. WT (Kap. 3.2.3).
POST /api/v1/end-supply takes malo_id, lieferende_datum (ISO-8601) and the
transaktionsgrund the Abmeldung 55004 makes Muss, and forwards
gpke.lieferende.anmelden as LF. POST /api/v1/end-supply-gas takes
malo_id, process_date (YYYYMMDD, INVALID_DATE otherwise) and the
transaktionsgrund the Abmeldung 44004 makes Muss (SG4 STS+7) — the fields
geli.lieferende.anmelden reads — and forwards it as LFG, the only role that
command is licensed to. For an ordinary Gas Wechsel (E03), the last assigned Gastag may be the seventh Werktag after submission. The exclusive end (DTM+93) falls on the next calendar day at 06:00. Receipt on 4 July 2016 permits process_date=20160714. HTTP 422 VORLAUFFRIST_VIOLATION returns that field as a ready-to-submit earliest_possible in YYYYMMDD format. The DTM+92 date for cancelling a future assignment remains the confirmed start. Contractual notice periods are checked by vertragd. AWH GeLi Gas 1.2, ch. 1.7, pp. 16–17.
POST /api/v1/kuendigung sends the Kündigung beim Vorversorger, LFN → LFA
(55016, gpke.kuendigung.anmelden): malo_id, the previous supplier's
lfa_mp_id and the „Ende zum" kuendigung_datum. kuendigung-gas is the
44016 (geli.kuendigung.anmelden as LFG) with a YYYYMMDD process_date.
vertragd calls them when a contract asks for the Kündigung; the answer reaches
it as the process's outcome.
Gas Datenabruf
Abrechnungsbrennwert and Zustandszahl are requested through makod's command
API (geli.datenabruf.anfragen, ORDERS 17103, payload malo_id, melo_id,
zeitspanne_von and zeitspanne_bis): the GNB answers within ten Werktage, but
not before the 10. Werktag of the month after the Zeitspanne ends (GeLi Gas 3.0
Kap. 4.2). The Zeitspanne lies in the past and ended at most twelve months
before the Anfrage.
The answer is MSCONS 13007 or ORDRSP 19103; a delivery updates edmd
meter_billing_periods via record_gas_quality.
Process read model
The read model is a module of every role build. Every de.mako.engine.* lifecycle
event the one POST /webhook receives is projected into one
process_projections row per business process before any decision module
sees it: the Antwortfrist at risk, the per-PID KPIs and the affiliate parity
are read from that row. A projection write that fails is not acknowledged, so the fan-out redelivers;
every module behind it is idempotent against a redelivery. The STP rate of
the read model is completions over the processes that ended in the window.
Two deadline clocks
Every MaKo process carries two independent deadlines. The read model measures the second; the first never reaches it.
| Clock | Window | A breach means | Where it shows |
|---|---|---|---|
| APERAK Frist | Strom UTILMD/ORDERS 45 min (Samstag: Sonntag 12:00), other Strom next Werktag 12:00; Gas Folgeprozess next Werktag 12:00, Initialprozess end of the 3. Werktag (APERAK AHB 1.1 Kap. 2.3.1 / 2.4.1) | the counterparty's acknowledgement did not arrive — a transport or validation fault | not in the read model: makod raises the delivery-window alert and keeps the message in its outbox |
| Antwortfrist | per PID — see below | the business answer is owed and has not been sent | deadline_at, computed on process.initiated |
state = antwortfrist_abgelaufen is set by de.mako.engine.antwortfrist.abgelaufen, which
gpke-supplier-change and geli-gas-supplier-change emit when their
Antwortfrist lapses unanswered — an Antwortfrist signal raised by the
workflow. total_antwortfrist_abgelaufen and total_frist_breached are separate fields
on every report; antwortfrist_abgelaufen is not terminal, so those processes stay in the
Antwortfrist sweep.
ProcessProjection
| Field | Description |
|---|---|
process_id | UUID — the CloudEvent subject |
pid | BDEW Prüfidentifikator (e.g. 55001) |
family | gpke, wim, geli-gas, wim-gas, gabi-gas, mabis, emob, redispatch, invoic-storno, unknown — the Festlegung of the PID's Antwortfrist; a two-Sparten WiM PID by data.sparte, else the counterparty's coding authority (293 / 332) |
workflow_name | From the makoworkflow CE extension |
state | initiated | running | antwortfrist_abgelaufen | completed | rejected | failed. A de.mako.engine.process.completed is rejected when its data.accepted is false or data.outcome is "rejected" — the type carries the Bestätigung and the Ablehnung alike — and completed otherwise; de.mako.engine.aperak.rejected is rejected too |
malo_id | 11-digit Marktlokations-ID |
partner_mp_id | MP-ID of the counterparty |
mdm_role | The operator's own Marktrolle in the process (LF, NB, MSB, BIKO), the marktrole marktd derives from the workflow name — not the counterparty's |
answered_at | Occurrence of the coded business reply, including where the process still owes its LF/NB notifications. |
market_reference | Original 21029 document, transaction, sender and receiver with roles, direction and Prüfidentifikator. The process and open-process MCP results retain this reference for the answer command. |
answer_context | On IFTSTA 21029, owed for the receiving wMSB, expected for the sending gMSB, informational for the addressed LF or NB, and unresolved for incomplete or inconsistent context. Other PIDs carry null. |
eingriff | The most human actor any event named (makoakteur): system < freigabe < freigabe-geaendert < person; never lowered |
started_at / last_event_at | First and most recent event seen for this process |
deadline_at | The business Antwortfrist. A missing deadline can indicate an informational copy, missing receipt time, unresolved responsibility or a process without a quantified window |
deadline_source | The Festlegung deadline_at came from |
deadline_risk | unknown | green | amber (< 24 h) | red (past) |
erc_code | APERAK ERC code when an APERAK refused the message — not the Antwortcode of a business refusal |
antwort_code / antwort_codeliste | The Antwortcode of the counterparty's business answer and the tree or Codeliste it named (SG4 STS+E01 on a UTILMD, SG2 AJT on an ORDRSP); one pair, see below |
bedeutung | The BDEW's wording of antwort_code within antwort_codeliste (mako_pruefung::codes::lies), on get_process and GET /obs/processes/{process_id}. Absent when the answer named no list or the list does not publish the code — never read from another tree |
initiator_is_affiliate | The Lieferant belongs to this operator's own undertaking |
antwort_code and antwort_codeliste are read from data.antwortcode /
data.codeliste. makod states them on the de.mako.engine.process.completed of an
answered Lieferbeginn (55002/55003, 44002/44003 and the other answers the LF
Anmeldung receives); every other event leaves them unchanged.
On an outgoing iMS 21029, a received A02, A03 or A04 emits de.mako.engine.process.answered, sets the process to
running and records its code and occurrence. The gMSB completes the regular
notification duty when it durably queues the LF/NB notices. A01 closes the
process on receipt. The counterparty record reports the time of the answer,
including while notices remain pending. See WiM Strom Teil 1 Kap. 3.5.2 Nr. 2–4,
pp. 62–64.
completed_at (not on the wire) is the time the first terminal event carries.
It feeds cycle time and caps the breach test
(deadline_at < COALESCE(completed_at, now())), so a process that closed late
counts as breached.
The Antwortfrist
The read model computes no deadline of its own: mako-fristen does, from the
same per-PID table makod registers deadlines from and the approval queue is
sized by.
| Family | Window | Source |
|---|---|---|
| GPKE Strom | a clock time on the 1. Werktag after the ÜT: 11:00 Anmeldung (55001/55077), 06:00 Abmeldung (55004), 05:00 Lieferende NB→LF (55007), 09:00 Beendigung der Zuordnung (55010); Kündigung 55016 to the end of the 1. WT | BK6-24-174 GPKE Teil 2 |
| GeLi Gas | Ablauf des 4. WT Anmeldung (44001), 3. WT Abmeldung (44004), 2. WT Ersatz-/Grundversorgung (44013), 3. WT Kündigung (44016) | BK7-24-01-009 Kap. 3.1–3.3 |
| WiM (Strom + Gas) | 3 / 5 / 7 / 1 Werktage (55039/55042/55051/55168 resp. 44039/44042/44051/44168), to the end of that Werktag in Berlin; REQOTE Preisanfrage 4/5/5 WT je PID; Rechnungsabwicklung 8 WT | BK6-24-174 Anlage 2a Kap. 2.2.2–2.5.2, 3.2.2, 3.6.3 · BDEW-AWH Änderung der Technik V1.1 Kap. 2.1.2 · AWH WiM Gas 2.0 |
| Ersteinbau iMS (21029) | Third Werktag after receipt by the wMSB. On the gMSB’s outgoing announcement the receipt time is unknown. The counterparty record lists eingang_unbestaetigt outside measured performance. LF and NB receive informational copies. | BK6-24-174, WiM Strom Teil 1 Kap. 3.5.2 Nr. 1–4, pp. 61–64 |
| Everything else | null — unknown, never unbounded | — |
A PID with no published window carries no deadline, is absent from every breach
sweep, and has deadline_risk = unknown — never green.
§ 7a Abs. 5 EnWG Gleichbehandlung parity
A vertically integrated undertaking's Gleichbehandlungsbeauftragte files a report with the Bundesnetzagentur by 31 March for the preceding calendar year (§ 7a Abs. 5 EnWG); the read model produces its Lieferantenwechsel evidence. The underlying duties are § 6a EnWG and § 20 Abs. 1 Satz 1 EnWG.
A process belongs to the calendar year in which it started, in
Europe/Berlin: one initiated on 1 January at 00:30 belongs to the new year,
although the stored instant is 31 December 23:30 UTC. The GET /obs/kpis month
is bounded by Berlin dates the same way, and grouping by start makes a re-run of
a closed year reproduce it.
The comparison covers the processes the network arm answers for a Lieferant,
derived from the Antwortfrist table (answered_by == "NB" in GPKE and GeLi Gas):
55001, 55077, 55004, 44001 and 44004. initiator_is_affiliate is set when the
Lieferant's MP-ID (new_supplier, else the counterparty) is in
[identity] verbundene_lieferanten or lf_mp_ids — the set the NB module
holds an affiliate's Anmeldung on, so the evidence and the hold cannot disagree.
gap_pp = affiliate − third_party, in percentage points; positive means the
affiliate fared better. gap_pp covers the completion rate, frist_gap_pp
the share answered inside the Antwortfrist; both are null when either group
has fewer than 10 processes. The Bundesnetzagentur publishes no numeric parity
limit; [obs] parity_threshold_pp is the operator's own escalation policy.
# JSON, for the current year
curl -s "http://processd:8580/api/v1/audit/gleichbehandlung?year=2026" \
-H "Authorization: Bearer $TOKEN" \
| jq '.by_pid[] | {pid, process, gap_pp, frist_gap_pp, favours}'
# CSV, for the filing: 15 columns; an unstatable rate is an empty cell
curl -s "http://processd:8580/api/v1/audit/gleichbehandlung?year=2025&format=csv" \
-H "Authorization: Bearer $TOKEN" > gleichbehandlung-2025.csvQueries
curl -s "http://processd:8580/obs/processes?family=gpke&state=initiated&pid=55001" \
-H "Authorization: Bearer $TOKEN" | jq '.[] | {process_id, started_at, deadline_at}'
curl -s "http://processd:8580/obs/kpis?pid=55001&period=2026-07" -H "Authorization: Bearer $TOKEN"
curl -s "http://processd:8580/obs/overdue" -H "Authorization: Bearer $TOKEN"
A KPI report also carries eingriff: the processes of the PID that ended
in the period (by the Berlin day of their ending, not started_at), each
counted once by its most human actor — ohne_eingriff, freigabe_unveraendert,
freigabe_geaendert, person, summing to beendet — with anteile only from
20 ended processes and the definition the figure is read by.
state accepts exactly the six stored spellings; anything else is a 400 naming
them. In a KPI report, check total_with_frist before quoting
frist_compliance_rate: a small denominator means the bucket is mostly
unmeasured. A null rate means nothing measurable in the bucket — not 0, and
not perfect performance.
Gegenpartei-Akte
What one counterparty owed us in a period, and how it answered — the evidence a complaint, a Schlichtung or a damages claim needs, process by process.
curl -s "http://processd:8580/api/v1/counterparties?von=2026-08-01&bis=2026-10-31" -H "Authorization: Bearer $TOKEN"
curl -s "http://processd:8580/api/v1/counterparties/9800468000003/NB?von=2026-08-01&bis=2026-10-31&format=csv" \
-H "Authorization: Bearer $TOKEN" > akte.csv
- Whose answer.
deadline_atis the PID's Antwortfrist whichever side started the process, andmdm_roleis our own role in it (marktd reads it off the workflow name). A process counts in the partner's Akte only wheremako_fristen::antwort'sanswered_bynames a role other than ours; one whose debtor cannot be told (no role, or one side of our own role —LFA,MSBA, …) and one without a Frist are counted apart inausserhalb; one we owe is not in it. - Answered is
completedorrejectedatcompleted_at; late iscompleted_at > deadline_at, to the minute, rounded up. Afailedprocess isabgebrochen, never answered. The period is Berlin calendar days onstarted_at, at most 366. - Refusals are grouped by Antwortcode and the list that named it, with the
BDEW wording from
mako_pruefung::codes::lies; an APERAK-refused process carries its ERC code underAPERAK. - Below 20 answered processes no share is stated, only counts. Every answer
carries its
definitionenand lists inprozesseevery process a figure counts; the CSV is those rows, its code cells quoted (RFC 4180) and a leading= + - @, tab or CR neutralised.
Rebuilding from marktd's event feed
The projection is a function of the events marktd fanned out, and marktd
serves its outbox as a feed, in commit order. POST /api/v1/obs/rebuild (Cedar
rebuild-projection, ADMIN) pages marktd GET /api/v1/events?type=de.mako.engine.*
by its cursor and hands each envelope to the projection function the webhook
calls — a truncated table rebuilt this way equals the original row for row. The
projection upserts on process_id, so a rebuild over a populated table repairs
it, and an interrupted rebuild is finished by sending it again.
The feed reaches back marktd's [subscriptions] retention_days (default 30): a
process whose events are older is not rebuilt. The answer names oldest_event,
the time of the oldest event the rebuild read, so the reach is visible.
marktd serves the feed only to a principal holding its read-events action,
so the [marktd] api_key processd uses must belong to one.
Events produced
Two sweeps produce de.mako.obs.* CloudEvents when [obs] outbound_url is set (in
production marktd's event ingest), HMAC-signed with [obs] outbound_secret:
| Event | When | Consumed by |
|---|---|---|
de.mako.obs.deadline.approaching | an open process has deadline_at within deadline_warn_hours, or already past it, and has not been alerted (deadline_alerted_at) | agentd deadline-alert-agent |
de.mako.obs.stp.parity.alert | either gap — completion rate or Frist compliance — passes parity_threshold_pp, with both groups ≥ 10 processes | agentd compliance-agent |
Only a delivered alert is stamped, so a downed target cannot consume a
warning; a sweep returning a full batch reports saturated.
Sperr-/Entsperrauftrag queue (NB role)
The Sperrauftrag queue is a module of an NB build (role-nb-strom /
role-nb-gas): the Netzbetreiber's work queue for the physical acts GPKE orders it to perform. An ORDERS 17115
Sperrauftrag or 17117 Entsperrauftrag from a Lieferant becomes a job for
the field team; the outcome goes back as IFTSTA 21039 (Auftragsstatus
Sperren/Entsperren). Without the IFTSTA the Lieferant's gpke-sperrung-lf
process never reaches a terminal state, so the queue retries and reports its
dispatch.
flowchart LR
LF["Lieferant"] -->|"ORDERS 17115 / 17117"| MAKOD["makod<br/>gpke-sperrung"]
MAKOD -->|"de.mako.engine.process.initiated"| WH["processd<br/>POST /webhook"]
WH --> Q[("sperr_orders<br/>pending")]
OP["Operator"] -->|"POST /api/v1/sperr-orders"| Q
Q --> FIELD["Field team"]
FIELD -->|"PUT /execute or /fail"| Q
Q -->|"gpke.sperrung.bestaetigen<br/>/ .fehlgeschlagen"| MAKOD
MAKOD -->|"IFTSTA 21039"| LF
The market inbox queues PIDs 17115 and 17117, keyed on the makod process so an
AS4 redelivery does not queue a second disconnection; an operator order has no
process_id and owes no IFTSTA. PID 17116 (Anfrage Sperrung, NB → MSB) is
not queued: it is not an order to execute.
| Column | EDIFACT | Meaning |
|---|---|---|
order_type | BGM+Z51 / Z52 | Sperrung / Entsperrung |
ausfuehrung_am | DTM+203 | A fixed date the LF requires (hint [533]: a Gerichtsvollzieher may have set it) |
fruehestens_am | DTM+469 | Execute at the next opportunity, but not before this date |
arbeitszeit | IMD+7081 Z53/Z54 | Entsperrauftrag: within working hours, or also outside |
treffpunkt_* | SG2 NAD+Z24 | Where the technician goes |
hinweis | SG29 FTX+ACB | The LF's free-text hints |
ausfuehrung_am and fruehestens_am are alternatives (AHB conditions
[55]/[56]), enforced in the API and by a CHECK.
Timing — three clocks, all published
BK6-24-174 GPKE Teil 2 Kap. 3.5.1.2 / 3.5.2.2 state three deadlines, counted in Werktagen on the BDEW-MaKo calendar:
| Clock | Frist | Tracked by |
|---|---|---|
| ORDRSP 19116 / 19117 answering the order | „spätester ÜT ist der 1. WT nach dem ÜT" (Prozessschritt 2) | makod, from mako_fristen::antwort |
| The physical act | „…spätestens innerhalb von 6 WT nach dem frühestmöglichen Sperrtermin" (Prozessschritt 1) | ausfuehrung_faellig_am |
| IFTSTA 21039 | „spätester ÜT ist der 1. WT nach dem Abschluss des Sperrauftrags" (Prozessschritt 5) | iftsta_faellig_am |
/stats reports overdue_pending for the Lieferant's own DTM+203 / DTM+469
and frist_ueberschritten for the regulatory window; a pending order past its
6 WT is announced once as de.mako.sperr.ausfuehrung.ueberfaellig. The
Vorlauffristen the Lieferant owes — 6 WT before the frühestmöglicher
Sperrtermin, 12 WT before a termingebundener one (Prozessschritt 1) — are
recorded as vorlauffrist_eingehalten and counted as vorlauffrist_verletzt,
never refused: Prozessschritt 2's checks do not include them. For a market order, created_at is the original CloudEvent occurrence. Both the recorded finding and the MSB window use its Berlin date, including when the webhook arrives late or is delivered again.
[policy] msb_vorlauf_lesart
Without a generelle Zustimmung of the MSB, the Sperrtermin is „vom NB so festzulegen, dass dem MSB noch eine fristgerechte Antwort auf Anfrage vor dem Sperrtermin möglich ist (s. dazu Fristen der SD-Schritte 3 und 4)" (BK6-24-174 Anlage 1b Kap. 3.5.1.2 Nr. 2, S. 106). Whether the Fristen of Nr. 3 and Nr. 4 add up is the operator's reading:
msb_vorlauf_lesart | Earliest Sperrtermin | Reading |
|---|---|---|
additiv (default) | 6 WT after the order arrived | Anfrage ≥ 3 WT before the Sperrtermin (Nr. 3, S. 106), then the MSB's 3 WT to answer (Nr. 4, S. 107) |
wortlaut | 3 WT after the order arrived | Nr. 3 alone; the answer only has to be possible before the Sperrtermin |
GET /api/v1/sperr-orders and GET /api/v1/sperr-orders/{id} state it per
Sperrauftrag as msb_fenster: the date asked for, fruehester_sperrtermin,
eingehalten and the lesart triple. processd records no Zustimmung, so the
field is stated, not enforced.
„Der NB führt bis zu zwei Sperrversuche innerhalb eines Sperrauftrags durch"
(Prozessschritt 5): PUT .../fail records the first unsuccessful visit and
leaves the order pending; the second closes it, as does endgueltig: true for a
legal or factual impossibility. A report may name whom the visit is put down
to — responsible: customer, contractor, operator or nobody — and the
order shows it with letzter_versuch_grund while it is still open.
Carried out by another system
A workforce tool, an ERP or a contractor's portal works the queue over the same routes and events; nothing here knows which.
- Its reference.
external_refis one opaque string, unique per tenant: given onPOST /api/v1/sperr-orders, or attached to an order that came from the market withPUT /api/v1/sperr-orders/{id}/external-ref. Everyde.mako.sperr.*event of the order echoes it, andGET /api/v1/sperr-orders?external_ref=finds the order. - When to go.
de.mako.sperr.auftrag.faelligis announced once on the day an order may be carried out: its requested date, or at once for an order that names none — an Entsperrauftrag is owed „unverzüglich" (§ 41f Abs. 7 EnWG). It carries the Treffpunkt, both dates,ausfuehrung_faellig_amand the Arbeitszeit, so the visit is planned from the event alone.?due=truelists the same orders. - Which came first. A cancel, or a report, that reaches an order no longer
pending answers
409 order_not_pendingwithstatusandexecuted_at. - An execution after the withdrawal is accepted, not refused: the supply
was interrupted whatever the queue says.
executeanswers202withconflict: "executed_after_cancel", the order stayscancelledand shows the report and theconflict,de.mako.sperr.ausfuehrung.nach-stornoannounces it, and no IFTSTA is queued — which Auftragsstatus a withdrawn order owes is a person's decision.
Reporting the outcome
PUT /api/v1/sperr-orders/{id}/execute and .../fail claim the order first
(UPDATE … WHERE status = 'pending') and only then dispatch, so a concurrent
execute and fail cannot both reach the wire. The IFTSTA carries SG15 STS Z37
(Sperren) / Z38 (Entsperren) with Z14 erfolgreich or Z13 gescheitert, the
EBD Prüfschritt code (pruefschritt_code, a Muss), and DTM+293
Fertigstellungsdatum — Muss on Z14 and ≤ the document date (condition [495]),
so a future executed_at is refused at the API (IFTSTA AHB 2.1 Kap. 7.2).
202: recorded, and the IFTSTA 21039 committed with it as an event_outbox
command to makod (key processd-sperr-iftsta-<order>); the Lieferant is told
once the outbox worker delivers it, which stamps iftsta_dispatched_at and
iftsta_ref. 204: an operator-created order, which owes no IFTSTA.
A terminal order with iftsta_dispatched_at IS NULL has an uninformed
Lieferant. The command follows the shared outbox policy — retries with backoff,
then the dead letter; iftsta_attempts and iftsta_last_error on the order are
read off it. A sweep announces de.mako.sperr.iftsta.ausstehend once when the
command is dead-lettered or iftsta_faellig_am has passed. /stats reports
iftsta_outstanding (in flight), iftsta_ueberfaellig (past the 1-WT window)
and iftsta_stuck (dead-lettered — the number that needs a human). A stuck
dispatch almost always means makod has no gpke-sperrung process for that
MaLo in ValidationPassed; after fixing the cause, requeue the command.
Emitted events
All go through the transactional outbox in the transaction of the state change.
The shared subscription module fans each one out to the webhook endpoint
default — [sperr] erp_webhook_url, signed with erp_hmac_secret — and to
every endpoint an ADMIN registers at /api/v1/webhooks/endpoints, as
Standard Webhooks deliveries with a log,
replay and GET /api/v1/events as a feed. Without a URL startup warns: the
notices then reach only the registered endpoints.
| CloudEvent | Emitted when |
|---|---|
de.mako.sperr.auftrag.eingegangen | An order entered the queue, from ORDERS or an operator |
de.mako.sperr.auftrag.faellig | The day a pending order may be carried out has come; once per order |
de.mako.sperr.ausgefuehrt | Carried out — IFTSTA Z14 |
de.mako.sperr.versuch.gescheitert | The first Sperrversuch failed and the order stayed pending |
de.mako.sperr.fehlgeschlagen | Not carried out — IFTSTA Z13, with the Prüfschritt code |
de.mako.sperr.storniert | A pending order was withdrawn; no IFTSTA |
de.mako.sperr.ausfuehrung.ueberfaellig | The 6-WT execution window closed with the order still open. The sweep claims each overdue order once, including across worker replicas. |
de.mako.sperr.ausfuehrung.nach-storno | An execution was reported for an order withdrawn beforehand |
de.mako.sperr.iftsta.ausstehend | The IFTSTA command was dead-lettered or the Kap. 3.5.1.2 Nr. 5 Frist has passed, and the LF is still uninformed |
Each type's data has a published schema, linked from the
event catalog. agentd's sperrd-agent
subscribes to the de.mako.sperr.* glob. All four
Sperrauftrag Cedar actions require the NB role and a tenant match;
tests/it/sperr/authorization_guard.rs fails the build if a handler loses its
Claims extractor or Cedar check.
Configuration reference
processd reads a TOML file (PROCESSD_CONFIG, default ./processd.toml);
"env:VAR_NAME" values defer secrets to the environment, and any key can be
overridden by PROCESSD_<SECTION>__<KEY> (e.g. PROCESSD_DATABASE__URL).
Unknown keys are refused, and a config error names every offending field.
cargo test -p processd --test it -- published_config parses the block below.
just test-processd-db runs the DB suites — the approval queue, the read
model's sweeps and rebuild, the webhook fan-out and the Sperrauftrag queue.
Full processd.toml reference
[http]
addr = "0.0.0.0:8580" # default
[database]
url = "env:DATABASE_URL" # required
pool_size = 10 # default
[identity]
tenant = "stadtwerke-musterstadt" # required, non-empty — the data-isolation key
# One list per Marktrolle, one MP-ID per Sparte (99… Strom, 98… Gas), each
# matching a makod.toml [[party]]. A role this deployment does not act in stays
# empty; at least one is set, and no MP-ID is in two lists (Allgemeine
# Festlegungen 6.1d Kap. 2.13).
nb_mp_ids = ["9900357000004", "9800357000004"] # NB, Neuanlage, EoG modules
lf_mp_ids = ["9900357000028", "9800357000028"] # LF module
msb_mp_ids = ["9900357000035", "9800357000035"] # MSB and ESA modules
# required, [] included — the affiliated Lieferanten beyond the own
# lf_mp_ids, which count as affiliated anyway. Their Anmeldungen are held for
# a person and grouped as affiliate in the § 7a Abs. 5 EnWG evidence.
verbundene_lieferanten = ["9912345000005"]
[makod]
url = "http://makod:8080" # required
api_key = "env:MAKOD_API_KEY" # required
[marktd]
url = "http://marktd:8180" # required
api_key = "env:MARKTD_API_KEY" # required
# Optional. The LF and MSB modules read contract facts from it; without it
# every contract fact is `Unbekannt` and the decisions asking one escalate.
[vertragd]
url = "http://vertragd:9780"
api_key = "env:VERTRAGD_API_KEY"
[webhook]
inbound_secret = "env:INBOUND_WEBHOOK_SECRET" # required unless allow_insecure_no_auth
# marktd delivers to processd through processd's entry in its own
# [[subscriptions.endpoints]] — url http://processd:8580/webhook, this secret,
# and every type processd reads (see marktd's „Fan-out"); processd registers
# nothing.
[nb]
auto_accept = false # true → dispatch bestaetigen automatically on Accept
gas_bearbeitungsfrist_wt = 3 # AWH GeLi Gas 2.0 Kap. 2.2
einsd_url = "" # EEG-/KWKG-Register; without it every 55077 escalates
einsd_api_key = ""
[lf]
auto_respond = true # false → every inbound LF process routed to approval_queue
# NB MP-IDs whose area this supplier is Grund-/Ersatzversorger in (E_0615
# Prüfschritt 20). Empty → every 55013 / 44013 escalates.
grundversorgungs_netzgebiete = ["9900000000001"]
eog_auto_respond = false # E_0615 / E_3008 dispatch, on top of auto_respond
# SG10 CCI+Z36 on a 55014: ZC9 §38 Ersatzversorgung, ZD0 §36 Grundversorgung,
# ZE3 vertragliche Ersatzbelieferung. Unset → an automatic Zustimmung is queued.
eog_versorgungsart = "ZD0"
# SG6 DTM+Z20 on a 44014 — this supplier's E/G billing interval in months:
# 1, 3, 6 or 12 (UTILMD MIG Gas G1.2). Required with eog_auto_respond in a Gas
# build; unset → an automatic Gas Zustimmung is queued.
eog_abrechnungsintervall_monate = 12
# The Bilanzkreise an answer (and a start-supply default) may name, by Sparte,
# Bilanzierungsgebiet and regime. Omit `bilanzierungsgebiet` for the Sparte's
# fallback row; eeg/kwkg are Strom only; no table → every 55607 escalates.
[[lf.bilanzkreise]]
sparte = "strom"
bilanzierungsgebiet = "11YN-BG-EON----A"
eeg = ["11XBK-EEG------Q"]
kwkg = ["11XBK-KWKG-----N"]
standard = ["11XBK-STD------Y"]
[msb]
auto_accept = false # true → dispatch the MSB-Wechsel Bestätigung
auto_preisanfrage = true # false → the REQOTE goes to the approval queue
[esa] # WiM Teil 2 Kap. 4 — the MSB's answers to an ESA
auto_accept = false # true → dispatch the E_0256/E_0257/E_0254 Zustimmungscode
auto_reject = false # true → dispatch a deterministic Ablehnungscode
accept_after_bindungsfrist = false # E_0256 Prüfschritt 2 — a commercial decision
[eog] # §36/§38 EnWG gap closure (NB role)
auto_activate = false # true → dispatch gpke.eog.anmelden on gap-detected
default_transaktionsgrund = "ZT6" # SG4 STS DE9013 for automatic Anmeldungen
warn_days_before_expiry = 14 # §38 Abs. 4 3-month warning lead
# notify_webhook_url = "https://erp.example/hooks/eog" # ersatz-auslaufend CloudEvents
# notify_webhook_secret = "env:EOG_WEBHOOK_SECRET"
[obs] # the process read model's de.mako.obs.* producers
# Target for de.mako.obs.deadline.approaching and de.mako.obs.stp.parity.alert, in
# production marktd's event ingest; omit to disable both sweeps.
outbound_url = "http://marktd:8180/api/v1/mako/events"
outbound_secret = "env:PROCESSD_OBS_OUTBOUND_SECRET" # HMAC; the target's inbound secret
deadline_sweep_secs = 900 # default
deadline_warn_hours = 24 # alert when an Antwortfrist is within this many hours
parity_sweep_secs = 86400 # default
parity_threshold_pp = 5.0 # the operator's own escalation threshold, not a regulatory one
parity_window_days = 90 # parity look-back window
[sperr] # NB Sperrauftrag queue — de.mako.sperr.* to the ERP
# erp_webhook_url = "https://erp.internal/hooks/sperr" # the webhook endpoint `default`
# erp_hmac_secret = "env:PROCESSD_SPERR_ERP_HMAC_SECRET" # required with erp_webhook_url
[subscriptions] # endpoints registered at /api/v1/webhooks/endpoints
retention_days = 30 # default — how long delivered events stay replayable
# allow_loopback = true # `just dev`'s local receivers; never in production
[policy]
msb_vorlauf_lesart = "additiv" # or "wortlaut" — the Sperrtermin without MSB-Zustimmung
# Required unless allow_insecure_no_auth = true.
[oidc]
issuer = "https://login.microsoftonline.com/{tenant-id}/v2.0"
audience = "api://mako-processd"
# jwks_refresh_secs = 300 # default
# [mcp] # optional /mcp bearer keys beside OIDC
# api_key = "env:PROCESSD_MCP_API_KEY"
# [[mcp.named_keys]] # one named key per agent, so audit logs say which
# name = "agentd"
# api_key = "env:AGENTD_MCP_KEY"| Flag / Env var | Default | Description |
|---|---|---|
--check | — | Probe the running instance's /health/ready on loopback and exit 0/non-zero (container HEALTHCHECK) |
PROCESSD_CONFIG | processd.toml | Path to the config file |
RUST_LOG / LOG_LEVEL | info | Log level |
OTEL_EXPORTER_OTLP_ENDPOINT | — | OTLP endpoint; unset disables tracing export |
Klärfälle
One case per message mako could not bring to its end, with a cause, an action
and a due date from code tables — never from a model (src/klaerfall.rs):
| Origin | Signal | Cause (code table) | Key |
|---|---|---|---|
aperak | de.mako.engine.aperak.rejected | ERC code → mako_engine::erc::recommended_action | the rejected message |
dead_letter | de.mako.engine.dead-letter.recorded | reason → mako_engine::dead_letter::action_for_label | the message, else dead-letter:<reason> |
refusal | de.mako.engine.process.completed whose Antwortcode refuses (outcome = rejected, or the code's cluster in its list) | the code in its tree, worded by mako_pruefung::codes::lies | the process |
frist_missed | de.mako.engine.antwortfrist.abgelaufen | the lapse | the process |
operator_decision | an approval_queue row, opened in the enqueue's transaction | the Freigabe | the process |
The key is the message and the MP-ID that sent the signal (partner_mp_id):
an APERAK from another partner citing the same reference opens that partner's
own case and never attaches to this one. A dead letter that names no message
keys on its reason, so a flood from one partner is one case. A further signal
for the same key, from any origin, attaches to the open case (occurrences,
origins); the first cause stands, and once a case is closed the next signal
opens a new one. due_at is the process's business Antwortfrist from the read
model, or null — „keine Frist", never a default, never a date the signal
carries; a Freigabe's expires_at (the Frist less an hour of headroom) is the
separate operator_window_ends_at, and an expired Freigabe's case stays open
and reads overdue once its Frist passed. Only codes are stored: a
counterparty's free text never reaches a case, and bedeutung is the BDEW's
own wording.
Correction. korrektur names the correcting command only where mako's
outbound answer is one a Freigabe sends: a pending Freigabe proposes its
approve command, an answer the counterparty refused by APERAK is re-sent from
the decided Freigabe; erlaubt is the Freigabe's approve/reject pair. Every
other case has korrektur: null and escalates.
Working a case. Reads — GET /api/v1/klaerfaelle, GET /api/v1/klaerfaelle/{id} (with its verlauf), MCP list_klaerfaelle,
get_klaerfall — return a case whose process mako ran in one of the caller's
Marktrollen, and a case on no process to ADMIN alone; another role's case
reads as absent. POST …/assign ({ "assignee": … }, null releases) and
POST …/resolve ({ "begruendung": … }, required) change no market state.
POST …/dispatch — „korrigieren & senden", { "befehl"?, "begruendung"?, "antwort"? } — sends korrektur.befehl, or another command of erlaubt with
a begruendung (422 begruendung_required; outside the pair 422 command_not_allowed; no correction 422 no_correction), through the Freigabe
decision path: a pending Freigabe is decided by its own approve/reject route,
a refused answer is rebuilt with decision_body, checked against its tree and
by makod's pre-send check, whose refusal comes back in place (422 pruefung_abgelehnt, the case stays open). Deciding a Freigabe on the queue
routes closes its case too. Every step appends to klaerfall_verlauf with the
authenticated principal — the proposal beside the command sent, and the reason;
a body naming decided_by is refused as an unknown field.
Equal treatment. GET /api/v1/audit/gleichbehandlung adds klaerfaelle:
per class of the initiating Lieferant (affiliate, third_party,
unattributed — a case on no process or on a process no Lieferant initiates),
the cases opened in the year, those closed and the median time to resolve. The
three sum to the cases opened; § 7a Abs. 5 EnWG does not name Klärfälle, so
this is supporting evidence.
MCP tools
/mcp (Streamable HTTP) takes an OIDC token or an [mcp] API key. The
transport checks use-mcp, then each tools/call against the tool's own Cedar
action; a tool with no mapped action is refused 403. approve_queue_entry /
reject_queue_entry stamp the verified caller as decided_by (an
unattributable decision is refused) and call processd's own
POST /api/v1/queue/{id}/approve / /reject over the loopback, so the REST
handler's decide-queue check runs as well. A decision is posted as
application/json and nothing else — a cross-site form cannot send it — and
one that states body_sha256 (from rehearse_decision) is refused 412 stale_body when the body it would dispatch is another.
Every check runs before the entry is claimed, so a refused decision leaves it
pending and marks nothing: processd's own (the frozen answer, the facts the
command needs, the Antwortcode against the entry's Entscheidungsbaum, the body
shown), then makod's pre-send check on exactly the message the decision
dispatches (POST /api/v1/probe/{command}). A refusal is 422 pruefung_abgelehnt with makod's sentence, stufe and the profile regeln; a
body makod did not rehearse is 422 nicht_geprueft with makod's code. So
no body the gate has not passed is approved — whoever proposed it, with agentd
switched off as well. makod grants the rehearsal with ActOnBehalf
([authz] act_on_behalf). The MCP tools return the route's refusal body as
the tool error.
| Tool | Cedar action | Description |
|---|---|---|
get_policy | use-mcp | The operator policy and posture this deployment runs under, as GET /api/v1/policy serves it |
list_decisions | read-decisions | Last N Anmeldung decisions with ERC codes and affiliate flag |
get_decision | read-decisions | Single Anmeldung decision by process_id, its Antwortcode with tree and BDEW wording |
get_stp_rate | read-decisions | Typed { stp_rate, window_days, target, compliant }: the Anmeldung STP rate over N days against processd's own 95 % operating target, null when nothing was decided |
get_stp_breakdown_by_erc | read-decisions | Refusals per Entscheidungsbaum and Antwortcode, each with the BDEW wording |
list_affiliate_decisions | read-decisions | Decisions involving affiliated suppliers (Gleichbehandlung evidence) |
list_pending_approvals | read-queue | Typed { freigaben, count, saturated }, earliest expires_at first; filters status, limit (≤ 200), marktrolle, process_id (one process's Freigaben), paged by offset. Each Freigabe: art (gehalten with its frozen antwort, or eskaliert) and per action the codes its tree allows (codes_freigeben, codes_ablehnen) |
get_queue_entry | read-queue | One Freigabe by UUID |
approve_queue_entry | decide-queue | Dispatch the entry's answer; takes antwort_code / antwort_tree / antwort_codeliste / bemerkung for an escalation, and the E/G facts the entry lists as missing |
reject_queue_entry | decide-queue | Dispatch the refusal with the operator's antwort_code, or bemerkung as the Begründung |
rehearse_decision | read-queue | A decision rehearsed with the route's own checks: urteil besteht with the makod command, payload and body_sha256, abgelehnt with grund (code, text, tree), or ohne_nachricht; claims and sends nothing |
get_counterparty_record | read-counterparty | Typed CounterpartyRecord: one counterparty's Akte in one role over a Berlin period, kept to the caller's Marktrollen |
list_counterparties | read-counterparty | Every counterparty and role that owed answers in a period, most late and unanswered first, kept to the caller's Marktrollen |
get_process | read-process | Full process projection — state, deadline, deadline_source, ERC code, the counterparty's Antwortcode with its list and bedeutung |
list_processes_by_family | read-process | One family, optionally one state; both are enumerated in the schema and an unknown value is refused |
list_open_processes | read-process | Open processes with given PIDs, earliest Frist first, a keyset page at a time (nach / weiter) |
count_open_processes | read-process | The same filter counted: open in total, Fristen ending before the Berlin day does, and the earliest of them |
list_overdue_processes | read-overdue | Past the business Antwortfrist, most urgent first; reports saturated |
get_kpi_report | read-kpi | Typed per-PID KPIs for a YYYY-MM month, both clocks separately, and eingriff — the ended processes by their most human actor, with its definition |
list_klaerfaelle | read-case | Typed { klaerfaelle, count, saturated }: the open Klärfälle, the earliest due_at first. See Klärfälle |
get_klaerfall | read-case | Typed KlaerfallAkte { klaerfall, verlauf }: one case with its history |
assign_klaerfall | assign-case | Take a case (assignee) or release it, over POST …/assign |
resolve_klaerfall | resolve-case | Close a case without a market message, begruendung required, over POST …/resolve |
dispatch_klaerfall | dispatch-case | „Korrigieren & senden" over POST …/dispatch; the route also checks decide-queue in the Freigabe's Marktrolle |
get_parity_report | read-kpi | § 7a Abs. 5 parity; gap_pp = affiliate − third_party |
get_process_stp_rate | read-kpi | Typed: completions over the processes that ended in the window, null when none did |
list_sperr_orders | read-sperr-order | The Sperrauftrag queue (NB build) |
get_sperr_order | read-sperr-order | One order, with ORDERS provenance and IFTSTA state |
get_sperr_stats | read-sperr-order | Counters, incl. iftsta_outstanding / iftsta_stuck |
list_due_orders | read-sperr-order | The field-dispatch list, with the Treffpunkt |
list_webhook_endpoints | manage-subscription | The webhook endpoints, as GET /api/v1/webhooks/endpoints lists them; secrets never |
list_webhook_deliveries | manage-subscription | One endpoint's deliveries, as GET /api/v1/webhooks/endpoints/{id}/deliveries lists them |
Guided prompts ship alongside them — triage-nb-rejection,
investigate-stp-drop, triage-msb-wechsel, trigger-lieferbeginn, the read
model's audit-kpi and investigate-aperak-violation, and in an NB build the
queue's execute-sperrung and iftsta-sweep. An agent key reading the
Sperrauftrag tools carries the NB role ([mcp] api_key_roles or a named
key's roles).
Monitoring
| Metric | Type | Description |
|---|---|---|
processd_decisions_total{decision,pid} | counter | NB STP decisions by outcome (Accept/Reject/Escalate) and PID (55001/55077/55004/44001/44004) |
processd_approval_queue_pending | gauge | Processes waiting for an operator decision |
processd_approval_queue_overdue | gauge | Pending entries past expires_at — the answer deadline has been missed |
processd_eog_open | gauge | Ersatz-/Grundversorgung cases not yet closed (§ 36/§ 38 EnWG) |
mako_process_beendet_total{pid,eingriff} | counter | Processes that ended, once each, by their most human actor (system, freigabe, freigabe-geaendert, person) — the share that ran without a person is eingriff="system" over all |
GET /obs/metrics serves the read model's gauges, computed from the store on
each scrape: processd_obs_process_projections_total,
processd_obs_open_processes_total, processd_obs_overdue_processes_total
(open and past their Antwortfrist), and processd_obs_db_pool_size /
processd_obs_db_pool_idle. It is unauthenticated — restrict it at the ingress.
| Alert | Condition | Usual cause |
|---|---|---|
| STP rate | Accept / total < 90 % (target ≥ 95 %) | missing malo_grid records |
| Escalation share | Escalate / total > 5 % | grid or register coverage |
| Overdue | processd_approval_queue_overdue > 0 | a business answer Frist was missed |
| Decision latency | > 10 s | marktd connectivity |
MSB module — WiM MSB-Wechsel STP
An NB build (role-nb-strom / role-nb-gas) answers 55042/44042 (Anmeldung
MSB) and 55051/44051 (Ende MSB); role-msb answers 55039/44039 (Kündigung MSB)
and 55168/44168 (Verpflichtungsanfrage). One handler serves both Sparten
because AWH WiM Gas 2.0 restates WiM Strom Teil 1 use-case for use-case. STP
target: ≥ 80 %. The Prüfschritte are mako_pruefung::msb.
de.mako.engine.process.initiated (PID 55039 / 55042 / 55051 / 55168)
→ GET marktd /api/v1/melos/{melo_id} ← MeLo known?
→ GET marktd /api/v1/msb-rahmenvertraege/check ← Rahmenvertrag § 9 Abs. 1 Nr. 3 MsbG?
(55042/44042: Sparte, NB, MSBN, Zuordnungsbeginn)
→ mako_pruefung::msb::pruefe_{anmeldung,abmeldung,kuendigung}
Accept → wim.geraetewechsel.bestaetigen (antwortcode) [if auto_accept]
else approval_queue with the WiM Frist
Reject → wim.geraetewechsel.ablehnen (antwortcode from the process's EBD)
Escalate → approval_queue with the WiM Frist
The Frist runs from the Übertragungstag in the CloudEvent's time, so a
redelivery does not restart it.
Anmeldung MSB (55042/44042), E_0201/E_2002, answered by the NB (WiM
Strom Teil 1 Kap. 2.3.2 Nr. 2; AWH WiM Gas 2.0 Kap. 3.5.2 Nr. 2):
| Check | Outcome on failure |
|---|---|
| Messlokation known to this NB | ZC9 |
| Versicherung über die Beauftragung durch den AN vorhanden | ZB6 |
| Mindestvorlaufzeit eingehalten — 15 WT, 7 WT bei erstmaliger Einrichtung | E17, naming the earliest reachable Zuordnungsbeginn |
Vertrag nach § 9 Abs. 1 Nr. 3 MsbG mit dem MSBN — marktd msb-rahmenvertraege/check for the order's Sparte, NB and MSBN, abgeschlossen and valid on the Zuordnungsbeginn | Escalate — E_0201 publishes no code. The reason names marktd's befund: no contract, one only angeboten, one beendet, or a Gas one still to be adapted to the Fassung GeLi Gas 3.0 Tenor 15 requires (anpassung_erforderlich); an order naming no NB or MSBN MP-ID escalates as an unknown Vertragslage. A marktd failure is a redelivery, never a finding |
The metering technology is not a ground: §5 MsbG gives the Anschlussnutzer a free choice of MSB, §14 MsbG the right to switch.
Ende MSB (55051), E_0202, answered by the NB. A Zuordnungsende inside the
20-Werktage Mindestvorlauffrist is set to the nächstmögliche Zuordnungsende and
confirmed Z01 (Kap. 2.4.2 Nr. 2). An Außerbetriebnahme has no lead time.
Kündigung MSB (55039), E_0200, answered by the MSBA. Every Prüfschritt is
about the MSBA's Messstellenbetriebsvertrag in vertragd
(GET /api/v1/messstellenvertraege/{melo_id}/{msb_mp_id}):
| Contract state | Outcome |
|---|---|
vertragd unreachable or unconfigured | Escalate |
404 — this MSB holds no contract here | ZC9 |
beendet_am set | Z29 |
kuendigung_zum set | the Kap. 2.2.3 table — E15, Z01 to an earlier date, or Z34 |
Live, requested date on or after naechstmoeglich | E15 |
| Live, requested date inside the binding | Z12, naming naechstmoeglich |
Live, no naechstmoeglich recorded | Escalate |
„Nächstmöglicher Termin" requested (DTM+471) | Z01, naming the date |
vertragd derives naechstmoeglich from the notice period, capped by § 309
Nr. 9 lit. c BGB.
Verpflichtungsanfrage (55168 / 44168), E_0240 / E_2006. One transmitted
after the 5. WT before the Zuordnungsende its SG4 DTM+76 names is refused
E17 (Kap. 2.4.2 Nr. 3), on 55170 resp. 44170. Otherwise Kap. 2.4.2
Nr. 4 leaves the answer „nach eigenem Ermessen" to the gMSB, so it escalates
with its 1-Werktag window.
Escalated decisions still write an anmeldung_decisions row.
MSB module — REQOTE auto-response
For PIDs 35001, 35002, 35004 and 35005 (REQOTE Preisanfrage) processd answers
from the active PreisblattMessung in marktd:
de.mako.engine.process.initiated (PIDs 35001/35002/35004/35005, REQOTE)
→ GET marktd /api/v1/preisblaetter-messung/{msb_mp_id} ← the Strom entry of [identity] msb_mp_ids
Found → wim.preisanfrage.angebot-senden
(includes preisblatt_gueltigkeit in payload for makod QUOTES build)
Not found → approval_queue with the REQOTE Frist — an operator quotes
[msb] auto_preisanfrage = false (default true) routes every REQOTE to the
approval queue, e.g. while a Preisblatt is being updated.
MSB module — ESA Wertebestellung (WiM Teil 2 Kap. 4)
Serving an Energieserviceanbieter is a mandatory Zusatzleistung (§34 Abs. 2
S. 2 Nr. 10 MsbG), so role-msb always carries:
| Inbound PID | Process | Answered with | Frist | EBD |
|---|---|---|---|---|
| 35003 | Werteanfrage (REQOTE) | QUOTES 15003 | 5 WT | E_0252 |
| 17007 | Bestellung von Werten | ORDRSP 19011/19012 | 2 WT | E_0256 |
| 39002 | Stornierung der Bestellung | ORDRSP 19013/19014 | 2 WT | E_0257 |
| 17008 | Abbestellung von Werten | ORDRSP 19011/19012 | 2 WT | E_0254 |
de.mako.engine.process.initiated (PID 35003 / 17007 / 17008 / 39002)
→ GET marktd /api/v1/esa/framework/{msb}/{esa} ← Rahmenvertrag established? (E_0256 Nr. 6)
→ GET marktd /api/v1/esa/consent-check ← Einwilligung still valid? (E_0256 Nr. 8)
→ GET marktd /api/v1/melos/{melo}/msb?at= ← MSB assigned for the period? (E_0256 Nr. 7)
→ GET marktd /api/v1/malos/{malo}/buendel?at= ← one MSB across the bundle? (E_0256 Nr. 11)
→ mako_pruefung::esa::wertebestellung::pruefe_{anfrage,bestellung,stornierung,beendigung}
Accept → wim.wertebestellung.*-beantworten (Zustimmungscode) [if auto_accept]
else approval_queue with the WiM Frist
Reject → the same command with the tree's Ablehnungscode [if auto_reject]
Escalate → approval_queue with the WiM Frist
The code's Cluster picks the answer PID, so Accept and Reject share one command.
[esa] auto_accept and auto_reject both default to false and are separate:
a wrong Bestätigung commits the MSB to a delivery, a wrong Ablehnung denies a
mandated Zusatzleistung.
The Werteanfrage is E_0252 („Anfrage prüfen", refusals A02–A07, EBD
4.3 Kap. 8.25.1), the MSB's tree. E_0253 and E_0258 are the ESA's checks of
the offer and the ORDRSP. A refusal goes out as
wim.wertebestellung.anfrage-ablehnen with the code's wording in FTX+ACB (the
15003 has no AJT). A surviving Anfrage queues with its 5-WT window: the
Angebot's Bindungsfrist, start, prices and OBIS registers are commercial terms.
A02–A07 mean different things in E_0252 and E_0256.
The Messprodukt-Katalog. Whether this MSB offers an optional Kapitel-4.6
product is stated in marktd's esa_messprodukt_katalog
(PUT /api/v1/esa/messprodukte/{msb_mp_id}, dated, with separate flags for the
two Abo modes: A04 declined Abo, A05 declined one-shot). An absent row
escalates; only a catalogue that omits the product yields A02/A04/A05.
The seven Pflichtprodukte (BNetzA Mitteilung Nr. 3) are served whatever the
catalogue holds, from their dated cut-over (9991 00000 077 1 and 078 9:
„Optional ab 01.10.2023, Pflicht ab 06.08.2024").
Gerätetechnik (E_0252 Nr. 6, E_0256 Nr. 9) is judged on the union of
the Messlokation's registers:
| Rule | Source |
|---|---|
| A Kapitel-4.6.2 product without an iMS cannot be served | UC 4.1.1 Vorbedingung: „Bei Übermittlung von Werten aus dem iMS: Alle … benötigten Messlokationen sind mit einem iMS ausgestattet." |
| A direction with no register | Zaehlwerk.richtung — AUSSP Verbrauch, EINSP Erzeugung |
| Blindarbeit with no Blindarbeit register | the OBIS C group: 1/2 Wirkarbeit, 3–8 Blindarbeit |
Still escalated: a ¼h Lastgang on a non-iMS meter (mako holds the
Zaehlertyp, not the RLM capability); no meter or no registers on record; an
unknown Abo start on a 17008 (E_0254 Prüfschritt 2 compares against the
Bestellung's DTM+203, carried as abo_beginn).
MSB module — §14a Steuerungsauftrag auto-ORDRSP
On a WiM Steuerungsauftrag (makoworkflow = wim-steuerungsauftrag) processd
confirms when the SteuerbareRessource has istFernschaltbar = true and the
produktcode is in its contracted konfigurationsprodukte (GPKE Teil 3
Kap. 1.3); an uncontracted produktcode is refused
(wim.steuerungsauftrag.ablehnen).
de.mako.engine.process.initiated (wim-steuerungsauftrag)
→ [parallel]
GET marktd /api/v1/steuerbare-ressourcen/{sr_id} ← istFernschaltbar?
GET marktd /api/v1/steuerbare-ressourcen/{sr_id}/konfigurationsprodukte ← contracted?
→ istFernschaltbar=true + produktcode contracted → bestaetigen
→ istFernschaltbar=true + produktcode NOT contracted → ablehnen (GPKE Teil 3 Kap. 1.3)
→ istFernschaltbar=false → Escalate (manual ORDRSP required)
→ SR not found → Escalate
Escalations queue with the 5-Werktage Steuerungsauftrag window less an hour.
Register contracted products via marktd's
PUT /api/v1/steuerbare-ressourcen/{sr_id}/konfigurationsprodukte.