Expand description
EngineModule trait, EngineBuilder, and EngineContext.
§Summary
EngineBuilder assembles all engine infrastructure into a single
EngineContext value. Domain modules (GPKE, WiM, GeLi Gas, …) register
themselves at startup via the EngineModule trait, making their names
visible in diagnostics and health checks.
§Type-state guarantee
EngineBuilder::build is only available when the event store type
parameter ES implements EventStore. Forgetting to call
with_event_store is a compile-time error, not a runtime panic.
All other stores default to their respective Noop implementations:
| Store | Default |
|---|---|
| Snapshot store | NoopSnapshotStore |
| Outbox store | NoopOutboxStore |
| Deadline store | NoopDeadlineStore |
| Process registry | NoopProcessRegistry |
§Assembly example
ⓘ
use mako_engine::builder::{EngineBuilder, EngineModule};
use mako_engine::event_store::InMemoryEventStore;
use mako_engine::outbox::InMemoryOutboxStore;
use mako_engine::deadline::InMemoryDeadlineStore;
use mako_engine::registry::InMemoryProcessRegistry;
use mako_engine::snapshot::InMemorySnapshotStore;
struct GpkeModule;
impl EngineModule for GpkeModule { fn name(&self) -> &'static str { "gpke" } }
let ctx = EngineBuilder::new()
.with_event_store(InMemoryEventStore::new())
.with_snapshot_store(InMemorySnapshotStore::new())
.with_outbox_store(InMemoryOutboxStore::new())
.with_deadline_store(InMemoryDeadlineStore::new())
.with_registry(InMemoryProcessRegistry::new())
.register(Box::new(GpkeModule))
.build();
// Spawn a fresh process:
let p = ctx.spawn::<SupplierChangeWorkflow>(tenant_id, workflow_id);
p.execute(ReceiveUtilmd { .. }).await?;
// Resume an existing process from a persisted identity:
let identity = ctx.registry.lookup(&conv_id.to_string()).await?.unwrap();
let p = ctx.resume::<SupplierChangeWorkflow>(identity);
// Access stores for delivery workers / schedulers:
let pending = ctx.outbox_store.pending_now(50).await?;
let overdue = ctx.deadline_store.due_now(50).await?;Structs§
- Deadline
Scheduler - A background task that polls
DeadlineStore::due_nowand dispatches deadline commands to the owning processes via a caller-supplied function. - Engine
Builder - Assembles engine infrastructure and produces an
EngineContext. - Engine
Context - Assembled engine infrastructure returned by
EngineBuilder::build. - LogAs4
Sender - An
As4Senderthat logs every outbound message atwarnlevel and succeeds without transmitting. - Noop
As4Sender - An
As4Senderthat succeeds immediately without sending anything. - Outbox
Worker - A background worker that drains the outbox by polling pending
OutboxMessages and dispatching them via anAs4Sender.
Traits§
- As4Sender
- Sends a single AS4 / EDIINT-over-HTTP outbound message.
- Engine
Module - A self-contained domain module that registers with the engine at startup.
Type Aliases§
- Minimal
Engine - An
EngineContextwith all optional subsystems disabled.