feat: processed-event ledger, idempotent dispatch

This commit is contained in:
2026-10-26 00:17:28 +01:00
parent fa8e94817a
commit 5681d0c034
29 changed files with 610 additions and 24 deletions

View File

@@ -18,6 +18,11 @@ pub struct WorkerApp {
}
impl WorkerApp {
/// Names of the registered event handlers, in registration order.
pub fn handler_names(&self) -> Vec<&'static str> {
self.service.handler_names()
}
/// Runs the handlers and, when there is one, the outbox relay, until
/// `shutdown` fires. Both stop together and finish their in-flight work.
///
@@ -142,6 +147,7 @@ async fn assemble(
let search_command = db.search_command;
let wrapup_repo = db.wrapup_repo;
let refresh_session = db.refresh_session;
let processed_events = db.processed_events;
let event_publisher = event_publisher_arc;
let metadata = metadata_client;
@@ -217,6 +223,9 @@ async fn assemble(
Arc::new(application::jobs::RefreshSessionCleanupJob::new(
Arc::clone(&refresh_session),
)),
Arc::new(application::jobs::ProcessedEventsCleanupJob::new(
Arc::clone(&processed_events),
)),
];
if let Some(job) = enrichment_job {
periodic_jobs.push(job);
@@ -301,7 +310,7 @@ async fn assemble(
};
Ok(WorkerApp {
service: WorkerService::new(consumer_arc, handlers),
service: WorkerService::new(consumer_arc, handlers, processed_events)?,
relay,
})
}