跳至内容

messages#

队列消息 #

基类: BaseModel

消息队列中的一条消息。

参数:

名称 类型 描述 默认值
id_ str
'1a063b1e-d3a2-4680-b395-df4cf7a08bb7'
publisher_id str

发布者的ID。

'default'
action ActionTypes | None
None
stats QueueMessageStats

队列消息的统计信息。

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

<dynamic>
type str

消息类型,用于路由。

'default'

属性:

名称 类型 描述
id_ str

消息的ID。

publisher_id str

发布者的ID。

data Dict[str, Any]

消息的数据。

action Optional[ActionTypes]

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

stats QueueMessageStats

消息的统计信息。

type str

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

Source code in 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."
    )
优云智算