protocol.rst 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. .. _internals-task-message-protocol:
  2. =======================
  3. Task Message Protocol
  4. =======================
  5. .. contents::
  6. :local:
  7. Message format
  8. ==============
  9. * task
  10. `string`
  11. Name of the task. **required**
  12. * id
  13. `string`
  14. Unique id of the task (UUID). **required**
  15. * args
  16. `list`
  17. List of arguments. Will be an empty list if not provided.
  18. * kwargs
  19. `dictionary`
  20. Dictionary of keyword arguments. Will be an empty dictionary if not
  21. provided.
  22. * retries
  23. `int`
  24. Current number of times this task has been retried.
  25. Defaults to `0` if not specified.
  26. * eta
  27. `string` (ISO 8601)
  28. Estimated time of arrival. This is the date and time in ISO 8601
  29. format. If not provided the message is not scheduled, but will be
  30. executed asap.
  31. * expires (introduced after v2.0.2)
  32. `string` (ISO 8601)
  33. Expiration date. This is the date and time in ISO 8601 format.
  34. If not provided the message will never expire. The message
  35. will be expired when the message is received and the expiration date
  36. has been exceeded.
  37. Example message
  38. ===============
  39. This is an example invocation of the `celery.task.PingTask` task in JSON
  40. format:
  41. .. code-block:: javascript
  42. {"id": "4cc7438e-afd4-4f8f-a2f3-f46567e7ca77",
  43. "task": "celery.task.PingTask",
  44. "args": [],
  45. "kwargs": {},
  46. "retries": 0,
  47. "eta": "2009-11-17T12:30:56.527191"}
  48. Serialization
  49. =============
  50. The protocol supports several serialization formats using the
  51. `content_type` message header.
  52. The MIME-types supported by default are shown in the following table.
  53. =============== =================================
  54. Scheme MIME Type
  55. =============== =================================
  56. json application/json
  57. yaml application/x-yaml
  58. pickle application/x-python-serialize
  59. msgpack application/x-msgpack
  60. =============== =================================