protocol.rst 1.9 KB

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