Skip to content

messages#

QueueMessage #

Bases: BaseModel

A message for the message queue.

Parameters:

Name Type Description Default
id_ str
'50f21b23-079a-4b37-9d97-13c99e06457b'
publisher_id str

Id of publisher.

'default'
data Dict[str, Any]
{}
action ActionTypes | None
None
stats QueueMessageStats
QueueMessageStats(publish_time=None, process_start_time=None, process_end_time=None)
type str

Type of the message, used for routing.

'default'

Attributes:

Name Type Description
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.

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."
    )