Events
Every CloudEvent flexpool sends and receives: one catalogue with schemas and classifications, signed webhooks, selection by contract, deduplication and trace context.
flexpool talks to other systems through CloudEvents 1.0 in structured mode (application/cloudevents+json), delivered as Standard Webhooks. It follows the Open Utility Stack conventions, so any system that follows them can take the other side.
What flexpool sends🔗
Every type is declared once, with its schema and classification, and every envelope is built from that declaration: an undeclared type cannot leave.
| Type | dataschema | dataclassification | subject |
|---|---|---|---|
de.flexpool.alarm.raised | …/events/v1/de.flexpool.alarm.raised.json | internal; for a unit in a home confidential, GDPR, standard | the alarm id |
de.flexpool.alarm.cleared | …/events/v1/de.flexpool.alarm.cleared.json | as above | the alarm id |
de.flexpool.flex.prognosis.sent | urn:open-utility-stack:flex-prognosis:1 | confidential | the congestion point |
de.flexpool.flex.offer.sent | urn:open-utility-stack:flex-offer:1 | confidential (prices) | the congestion point |
de.flexpool.erasure.confirmed | urn:open-utility-stack:erasure:1#/$defs/Confirmation | confidential, GDPR, standard | the erased person's reference |
flexpool's own schemas are closed JSON Schemas (additionalProperties: false) with the major version in the path, so an additive change keeps the URI and a breaking one gets a new URI.
Every event carries:
source: a URI naming the deployment (events.source, such ashttps://estate.example/tenants/swm/flexpool), sosource+idis unique.partitionkey: equal tosubject. Events with the same key are ordered.time: RFC 3339 in UTC, ending inZ.correlationidandcausationid: on every event another one caused.traceparent: the W3C trace that started the chain. It is never rewritten per hop; each HTTP delivery sends its own span of that trace in thetraceparentheader.
What flexpool receives🔗
POST /api/v1/events takes one structured event or a JSON array of them:
dataschema | What flexpool does |
|---|---|
urn:open-utility-stack:flex-request:1 | drafts an offer (Flexibility market) |
urn:open-utility-stack:flex-order:1 | records the order against the offer it orders |
urn:open-utility-stack:flex-settlement:1 | recomputes it and records a verdict |
urn:open-utility-stack:erasure:1 | acts on it (Data protection) |
The rules, in the order flexpool applies them:
- Signed. The body must carry a valid Standard Webhooks signature by one of
events.inbound_secrets, made within five minutes, and the request passes the daemon's authentication. Without both, the answer is401. In scenario mode the sandbox's grid operator signs with a secret of its own that exists only for that run. - By contract, not by sender. An event is selected by its
dataschemaalone, compared exactly, fragment included. Itstypeand its sender do not matter. - Classified. An event without
dataclassification, or with a value flexpool does not recognise, is refused. So isdataregulationwithoutdatacategory. - Once. Events are deduplicated on
source+id. A repeat is answeredduplicateand changes nothing.
The answer lists what happened to each event (accepted, duplicate or refused, with a reason). When every event is refused, the answer is 400, so a sender can tell a bad batch from a good one.
curl -s localhost:8080/api/v1/events \
-H 'content-type: application/cloudevents+json' \
-H "webhook-id: $ID" -H "webhook-timestamp: $TS" -H "webhook-signature: $SIG" \
--data @request.jsonTracing🔗
Every HTTP request keeps its caller's traceparent, or starts a trace, and its log span names the trace id. Each inbound event is processed in a span named by the OpenTelemetry semantic conventions for messaging and CloudEvents (cloudevents.event_id, cloudevents.event_source, cloudevents.event_type, cloudevents.event_subject), with the event's own traceparent recorded as its link.