ironmq.rst 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. .. _broker-ironmq:
  2. ==================
  3. Using IronMQ
  4. ==================
  5. .. _broker-ironmq-installation:
  6. Installation
  7. ============
  8. For IronMQ support, you'll need the [iron_celery](http://github.com/iron-io/iron_celery) library:
  9. .. code-block:: bash
  10. $ pip install iron_celery
  11. As well as an [Iron.io account](http://www.iron.io). Sign up for free at [iron.io](http://www.iron.io).
  12. .. _broker-ironmq-configuration:
  13. Configuration
  14. =============
  15. First, you'll need to import the iron_celery library right after you import Celery, for example::
  16. from celery import Celery
  17. import iron_celery
  18. app = Celery('mytasks', broker='ironmq://', backend='ironcache://')
  19. You have to specify IronMQ in the broker URL::
  20. BROKER_URL = 'ironmq://ABCDEFGHIJKLMNOPQRST:ZYXK7NiynGlTogH8Nj+P9nlE73sq3@'
  21. where the URL format is::
  22. ironmq://project_id:token@
  23. you must *remember to include the "@" at the end*.
  24. The login credentials can also be set using the environment variables
  25. :envvar:`IRON_TOKEN` and :envvar:`IRON_PROJECT_ID`, which are set automatically if you use the IronMQ Heroku add-on.
  26. And in this case the broker url may only be::
  27. ironmq://
  28. Clouds
  29. ------
  30. The default cloud/region is ``AWS us-east-1``. You can choose the IronMQ Rackspace (ORD) cloud by changing the URL to::
  31. ironmq://project_id:token@mq-rackspace-ord.iron.io
  32. Results
  33. =======
  34. You can store results in IronCache with the same Iron.io credentials, just set the results URL with the same syntax
  35. as the broker URL, but changing the start to ``ironcache``::
  36. ironcache:://project_id:token@
  37. This will default to a cache named "Celery", if you want to change that::
  38. ironcache:://project_id:token@/awesomecache
  39. More Information
  40. ================
  41. You can find more information in the [iron_celery README](http://github.com/iron-io/iron_celery).