跳到内容

messages#

QueueMessage #

基类: BaseModel

消息队列的消息。

参数

名称 类型 描述 默认值
id_ str
'186c0df5-c78f-44e0-a59c-443d16d98d92'
publisher_id str

发布者 ID。

'default'
action ActionTypes | None
None
stats QueueMessageStats

消息队列统计信息。

属性: publish_time (可选[str]): 消息发布时间。 process_start_time (可选[str]): 消息处理开始时间。 process_end_time (可选[str]): 消息处理结束时间。

<dynamic>
type str

消息类型,用于路由。

'default'

属性

名称 类型 描述
id_ str

消息 ID。

publisher_id str

发布者 ID。

data Dict[str, Any]

消息数据。

action Optional[ActionTypes]

消息的操作,用于决定如何处理消息。

stats QueueMessageStats

消息统计信息。

type str

消息类型。通常是一个服务名称。

源代码位于 llama_deploy/messages/base.py
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
class QueueMessage(BaseModel):
    """A message for the message queue.

    Attributes:
        id_ (str):
            The id of the message.
        publisher_id (str):
            The id of the publisher.
        data (Dict[str, Any]):
            The data of the message.
        action (Optional[ActionTypes]):
            The action of the message, used for deciding how to process the message.
        stats (QueueMessageStats):
            The stats of the message.
        type (str):
            The type of the message. Typically this is a service name.
    """

    model_config = ConfigDict(arbitrary_types_allowed=True)
    id_: str = Field(default_factory=lambda: str(uuid.uuid4()))
    publisher_id: str = Field(default="default", description="Id of publisher.")
    data: Dict[str, Any] = Field(default_factory=dict)
    action: Optional[ActionTypes] = None
    stats: QueueMessageStats = Field(default_factory=QueueMessageStats)
    type: str = Field(
        default="default", description="Type of the message, used for routing."
    )