updated Services Task database
This commit is contained in:
@@ -10,6 +10,7 @@ COPY app/services/parser/mail/README.md ./
|
||||
|
||||
COPY app/core ./app/core
|
||||
COPY app/services/common/ ./app/services/common/
|
||||
COPY app/services/types/ ./app/services/types/
|
||||
COPY app/services/parser/mail/ ./app/services/parser/mail/
|
||||
|
||||
RUN pip install --upgrade pip && pip install --no-cache-dir .
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
import os
|
||||
import asyncio
|
||||
import fnmatch
|
||||
|
||||
from app.services.common.service_base_async import ServiceBaseAsync, Job
|
||||
from app.services.types.queue import Enqueue
|
||||
from app.services.common.service_base_async import ServiceBaseAsync
|
||||
from app.services.types.task import Job
|
||||
from app.services.types.mail import ProcessMailObject
|
||||
|
||||
|
||||
PRODUCE_BURST = int(os.getenv("PRODUCE_BURST", "10"))
|
||||
@@ -15,16 +19,20 @@ async def produce(svc: ServiceBaseAsync):
|
||||
|
||||
|
||||
async def handle_mail_publish(svc: ServiceBaseAsync, job: dict):
|
||||
# Check for bank mail is from which Bank and to which bulding
|
||||
job_model = Job(**job)
|
||||
mail_id = job_model.payload['mail_id']
|
||||
process_mail_object = ProcessMailObject(**job_model.payload)
|
||||
mail_id = process_mail_object.data.id
|
||||
task_id = f"IsBankServiceMailParser_{mail_id}"
|
||||
await svc.enqueue(task_id=task_id, payload=job_model.payload, type_="parser.excel.publish")
|
||||
print("Parser Mail Consumer parsed handle_mail_publish :", job_model.task_id)
|
||||
enqueue = Enqueue(task_id=task_id, payload=process_mail_object.model_dump(), action="parser.excel.publish")
|
||||
await svc.enqueue(enqueue)
|
||||
print(f"Parser Mail Consumer parsed handle_mail_publish : {enqueue.task_id}")
|
||||
await svc.ack_current()
|
||||
await asyncio.sleep(PROCESS_SEC)
|
||||
|
||||
|
||||
async def handle_mongo_publish(svc: ServiceBaseAsync, job: dict):
|
||||
print('job', job)
|
||||
job_model = Job(**job)
|
||||
await svc.ack_current()
|
||||
print("Parser Mail Consumer default handle_mongo_publish :", job_model.task_id)
|
||||
|
||||
Reference in New Issue
Block a user