from svc_infra.jobs.registry import JobRegistryRegistry for job handlers with dispatch and metrics. Provides a centralized way to register job handlers and dispatch jobs to them with optional timeout and Prometheus metrics.
metric_prefix: Prefix for Prometheus metric names (default: "jobs")
registry = JobRegistry(metric_prefix="myapp_jobs") # Register with decorator @registry.handler("process_order") async def handle_order(job: Job) -> JobResult: order_id = job.payload["order_id"] return JobResult(success=True, message=f"Processed order {order_id}") # Register imperatively registry.register("send_notification", send_notification_handler) # Dispatch result = await registry.dispatch(job, timeout=60.0)