flexpool

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.

Typedataschemadataclassificationsubject
de.flexpool.alarm.raised…/events/v1/de.flexpool.alarm.raised.jsoninternal; for a unit in a home confidential, GDPR, standardthe alarm id
de.flexpool.alarm.cleared…/events/v1/de.flexpool.alarm.cleared.jsonas abovethe alarm id
de.flexpool.flex.prognosis.senturn:open-utility-stack:flex-prognosis:1confidentialthe congestion point
de.flexpool.flex.offer.senturn:open-utility-stack:flex-offer:1confidential (prices)the congestion point
de.flexpool.erasure.confirmedurn:open-utility-stack:erasure:1#/$defs/Confirmationconfidential, GDPR, standardthe 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:

What flexpool receives🔗

POST /api/v1/events takes one structured event or a JSON array of them:

dataschemaWhat flexpool does
urn:open-utility-stack:flex-request:1drafts an offer (Flexibility market)
urn:open-utility-stack:flex-order:1records the order against the offer it orders
urn:open-utility-stack:flex-settlement:1recomputes it and records a verdict
urn:open-utility-stack:erasure:1acts on it (Data protection)

The rules, in the order flexpool applies them:

  1. 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 is 401. In scenario mode the sandbox's grid operator signs with a secret of its own that exists only for that run.
  2. By contract, not by sender. An event is selected by its dataschema alone, compared exactly, fragment included. Its type and its sender do not matter.
  3. Classified. An event without dataclassification, or with a value flexpool does not recognise, is refused. So is dataregulation without datacategory.
  4. Once. Events are deduplicated on source + id. A repeat is answered duplicate and 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.json

Tracing🔗

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.

Edit this page