kombu/docs/userguide/examples.rst

58 lines
1.0 KiB
ReStructuredText
Raw Normal View History

2011-09-22 16:10:13 +00:00
.. _examples:
========================
Examples
========================
2012-12-11 04:35:02 +00:00
.. _hello-world-example:
Hello World Example
===================
2012-12-11 04:35:02 +00:00
Below example uses
2012-12-11 04:35:02 +00:00
:ref:`guide-simple`
to send helloworld message through
2012-12-11 04:35:02 +00:00
message broker (rabbitmq) and print received message
:file:`hello_publisher.py`:
.. literalinclude:: ../../examples/hello_publisher.py
:language: python
2012-12-11 04:35:02 +00:00
:file:`hello_consumer.py`:
.. literalinclude:: ../../examples/hello_consumer.py
:language: python
2011-09-22 16:10:13 +00:00
.. _task-queue-example:
2011-09-12 09:25:42 +00:00
Task Queue Example
==================
Very simple task queue using pickle, with primitive support
for priorities using different queues.
:file:`queues.py`:
.. literalinclude:: ../../examples/simple_task_queue/queues.py
:language: python
:file:`worker.py`:
.. literalinclude:: ../../examples/simple_task_queue/worker.py
:language: python
:file:`tasks.py`:
.. literalinclude:: ../../examples/simple_task_queue/tasks.py
:language: python
.. code-block:: python
:file:`client.py`:
.. literalinclude:: ../../examples/simple_task_queue/client.py