Skip to main content

Module deadline

Module deadline 

Source
Expand description

Deadline tracking for regulatory process timers.

Every MaKo process is subject to hard regulatory deadlines defined in the BDEW Application Handbooks. Deadline semantics vary by process family:

Process familyDeadline unitHelper
GPKE Lieferantenwechsel (BK6-22-024)24 wall-clock hoursfristen::add_hours
WiM / GeLi Gas / MABISWerktagefristen::add_werktage

Use the helpers in crate::fristen to compute the correct due_at timestamp before constructing a Deadline.

The DeadlineStore persists these timers per process stream. A background scheduler polls DeadlineStore::due_now and dispatches a TimeoutDeadline command to the owning process when a deadline lapses. The process workflow then handles the command — e.g. by escalating the case or switching to a failure path.

§Usage

use mako_engine::fristen;

// GPKE 24h Lieferantenwechsel (BK6-22-024):
let due = fristen::add_hours(OffsetDateTime::now_utc(), 24);
// WiM 5-Werktage confirmation window:
let due = fristen::add_werktage(OffsetDateTime::now_utc().date(), 5,
    fristen::HolidayCalendar::BdewMaKo).midnight().assume_utc();

let deadline = Deadline::new(
    process.stream_id().clone(),
    process.process_id(),
    process.tenant_id(),
    process.workflow_id().clone(),
    "aperak-response-window",
    due,
);
deadline_store.register(&deadline).await?;

// When the counterparty responds in time, cancel the deadline:
deadline_store.cancel(deadline.deadline_id()).await?;

// Background scheduler (runs every N minutes):
let result = deadline_store.due_now(100).await?;
for d in result.deadlines {
    process_handle.execute(TimeoutDeadline { deadline_id: d.deadline_id() }).await?;
    deadline_store.cancel(d.deadline_id()).await?;
}

Structs§

Deadline
A registered regulatory deadline for a single process stream.
DueNowResult
Result of a DeadlineStore::due_now poll.
NoopDeadlineStore
A DeadlineStore that never persists anything.

Traits§

DeadlineStore
Storage contract for process deadlines.