plba
This commit is contained in:
18
src/app_runtime/contracts/tasks.py
Normal file
18
src/app_runtime/contracts/tasks.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Any
|
||||
|
||||
|
||||
@dataclass(slots=True)
|
||||
class Task:
|
||||
name: str
|
||||
payload: dict[str, Any]
|
||||
metadata: dict[str, Any] = field(default_factory=dict)
|
||||
|
||||
|
||||
class TaskHandler(ABC):
|
||||
@abstractmethod
|
||||
def handle(self, task: Task) -> None:
|
||||
"""Execute domain logic for a task."""
|
||||
Reference in New Issue
Block a user