TaskMessage
Create task message in protocol 2 format.
def TaskMessage(
name: str,
id: str = None,
args: Sequence = (),
kwargs: Mapping = None,
callbacks: Sequence[Signature] = None,
errbacks: Sequence[Signature] = None,
chain: Sequence[Signature] = None,
shadow: str = None,
utc: bool = None,
**options: Any
) - > Mock
Create task message in protocol 2 format.
Parameters
| Name | Type | Description |
|---|---|---|
| name | str | The fully qualified name of the task to be executed. |
| id | str = None | The unique identifier for the task; if not provided, a new UUID is generated. |
| args | Sequence = () | Positional arguments to be passed to the task function. |
| kwargs | Mapping = None | Keyword arguments to be passed to the task function. |
| callbacks | Sequence[Signature] = None | A list of task signatures to be executed upon successful completion of the task. |
| errbacks | Sequence[Signature] = None | A list of task signatures to be executed if the task encounters an error. |
| chain | Sequence[Signature] = None | A list of subsequent task signatures to be executed in a chain. |
| shadow | str = None | An alternative name to use for the task in logs and monitoring tools. |
| utc | bool = None | Flag indicating whether timestamps should use UTC. |
| **options | Any | Additional header fields or execution options to include in the message metadata. |
Returns
| Type | Description |
|---|---|
Mock | A mock message object containing the serialized task payload, headers, and metadata required for Celery protocol 2 communication. |