Files
LegacyHUB/scripts/consume_dispatch_inbox.py
Vadim Malanov 272cbf6d92
Some checks failed
CI / Backend (lint + tests + compose) (push) Has been cancelled
CI / Frontend (lint + type-check + build) (push) Has been cancelled
feat(dispatch): consume QMS asset events from the service inbox (C2)
LegacyHUB is subscribed to AssetRegistered/AssetApproved from QMS but
never polled its service inbox. New consumer maps the §7 payload to an
AssetManifestEnvelope and runs the local knowledge-ingest, then confirms
the delivery. Outcome policy avoids head-of-line blocking: Registered →
ingest (accepted/duplicate/rejected all confirm), Approved/unknown →
confirm without work, malformed → confirm as poison; only transient
infrastructure failures (object_read_failed) leave the message pending
and stop the run for the next scheduled retry. Thin CLI wrapper
scripts/consume_dispatch_inbox.py (scripts/ ships in the image).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-12 12:39:44 +03:00

25 lines
679 B
Python

"""Drain the dispatch service inbox once (QMS §7 asset events → knowledge-ingest)."""
from __future__ import annotations
import argparse
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))
from app.integrations.dispatch_inbox_consumer import consume_once # noqa: E402
def main(argv: list[str] | None = None) -> int:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--limit", type=int, default=25)
args = parser.parse_args(argv)
print(consume_once(limit=args.limit))
return 0
if __name__ == "__main__":
raise SystemExit(main())