Persist durable event consumer delivery state
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from govoplan_audit.backend.db import models as audit_models # noqa: F401 - populate Audit ORM metadata
|
||||
from govoplan_core.core.access import (
|
||||
CAPABILITY_AUDIT_RECORDER,
|
||||
@@ -36,10 +38,15 @@ def _audit_retention(context: ModuleContext):
|
||||
|
||||
|
||||
def _event_outbox(context: ModuleContext):
|
||||
del context
|
||||
from govoplan_audit.backend.outbox import SqlAuditOutbox
|
||||
|
||||
return SqlAuditOutbox()
|
||||
return SqlAuditOutbox(
|
||||
max_attempts=getattr(
|
||||
context.settings,
|
||||
"platform_event_outbox_max_attempts",
|
||||
8,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
manifest = ModuleManifest(
|
||||
@@ -59,12 +66,25 @@ manifest = ModuleManifest(
|
||||
migration_spec=MigrationSpec(
|
||||
module_id="audit",
|
||||
metadata=Base.metadata,
|
||||
script_location=str(
|
||||
Path(__file__).with_name("migrations") / "versions"
|
||||
),
|
||||
retirement_supported=True,
|
||||
retirement_provider=drop_table_retirement_provider(audit_models.AuditLog, audit_models.AuditOutboxEvent, label="Audit"),
|
||||
retirement_provider=drop_table_retirement_provider(
|
||||
audit_models.AuditLog,
|
||||
audit_models.AuditOutboxDelivery,
|
||||
audit_models.AuditOutboxEvent,
|
||||
label="Audit",
|
||||
),
|
||||
retirement_notes="Destructive retirement drops audit-owned database tables after the installer captures a database snapshot.",
|
||||
),
|
||||
uninstall_guard_providers=(
|
||||
persistent_table_uninstall_guard(audit_models.AuditLog, audit_models.AuditOutboxEvent, label="Audit"),
|
||||
persistent_table_uninstall_guard(
|
||||
audit_models.AuditLog,
|
||||
audit_models.AuditOutboxDelivery,
|
||||
audit_models.AuditOutboxEvent,
|
||||
label="Audit",
|
||||
),
|
||||
),
|
||||
capability_factories={
|
||||
CAPABILITY_AUDIT_RECORDER: _audit_recorder,
|
||||
|
||||
Reference in New Issue
Block a user