protov2.rst 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. # protocol v2 implies UTC=True
  2. # 'class' header existing means protocol is v2
  3. properties = {
  4. 'correlation_id': (uuid)task_id,
  5. 'content_type': (string)mime,
  6. 'content_encoding': (string)encoding,
  7. # optional
  8. 'reply_to': (string)queue_or_url,
  9. }
  10. headers = {
  11. 'lang': (string)'py'
  12. 'class': (string)task,
  13. # optional
  14. 'method': (string)'',
  15. 'eta': (iso8601)eta,
  16. 'expires'; (iso8601)expires,
  17. 'callbacks': (list)Signature,
  18. 'errbacks': (list)Signature,
  19. 'chain': (list)Signature, # non-recursive
  20. 'group': (uuid)group_id,
  21. 'chord': (uuid)chord_id,
  22. 'retries': (int)retries,
  23. }
  24. body = (args, kwargs)
  25. Example:
  26. # chain: add(add(add(2, 2), 4), 8) = 2 + 2 + 4 + 8
  27. task_id = uuid()
  28. basic_publish(
  29. message=json.dumps([[2, 2], {}]),
  30. application_headers={
  31. 'lang': 'py',
  32. 'class': 'proj.tasks.add',
  33. 'chain': [
  34. {'task': 'proj.tasks.add', 'args': (4, )},
  35. {'task': 'proj.tasks.add', 'args': (8, )},
  36. ]
  37. }
  38. properties={
  39. 'correlation_id': task_id,
  40. 'content_type': 'application/json',
  41. 'content_encoding': 'utf-8',
  42. }
  43. )