parser excel publish chain task build
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import os
|
||||
import json
|
||||
import uuid
|
||||
import asyncio
|
||||
import fnmatch
|
||||
import aio_pika
|
||||
|
||||
from pydantic import BaseModel
|
||||
from core.utils import now_ms
|
||||
from contextvars import ContextVar
|
||||
from aio_pika.abc import AbstractIncomingMessage
|
||||
@@ -20,6 +20,20 @@ class _MsgCtx(NamedTuple):
|
||||
_MSG_CTX: ContextVar[_MsgCtx | None] = ContextVar("_MSG_CTX", default=None)
|
||||
|
||||
|
||||
class Meta(BaseModel):
|
||||
routing_key: str
|
||||
attempts: int
|
||||
exchange: str
|
||||
|
||||
|
||||
class Job(BaseModel):
|
||||
task_id: str
|
||||
type: str
|
||||
payload: dict
|
||||
created_at: int
|
||||
_meta: Meta
|
||||
|
||||
|
||||
class ServiceBaseAsync:
|
||||
"""
|
||||
RabbitMQ tabanlı async servis iskeleti.
|
||||
@@ -52,7 +66,7 @@ class ServiceBaseAsync:
|
||||
self.queue_dlq = f"{self.queue_main}.dlq"
|
||||
self.retry_delay_ms = int(os.getenv("RETRY_DELAY_MS", "5000"))
|
||||
self.max_retries = int(os.getenv("MAX_RETRIES", "3"))
|
||||
self.prefetch = int(os.getenv("PREFETCH", "16"))
|
||||
self.prefetch = int(os.getenv("PREFETCH", "5"))
|
||||
self.ignore_self = os.getenv("IGNORE_SELF_PRODUCED", "true").lower() == "true"
|
||||
|
||||
self.produce_fn = produce_fn
|
||||
@@ -163,7 +177,6 @@ class ServiceBaseAsync:
|
||||
attempts = int(msg.headers.get("x-attempts", 0))
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
handler = self._resolve_handler(msg.routing_key) or self.consume_fn
|
||||
meta = job.setdefault("_meta", {})
|
||||
meta["routing_key"] = msg.routing_key
|
||||
|
||||
Reference in New Issue
Block a user