summaryrefslogtreecommitdiff
path: root/docs/userguide/examples.rst
blob: e4d20c18a04ffccaede4e1fb5ba26a7bb29bfc12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
.. _examples:

========================
 Examples
========================

.. _hello-world-example:

Hello World Example
===================

Below example uses
:ref:`guide-simple`
to send helloworld message through
message broker (rabbitmq) and print received message


:file:`hello_publisher.py`:

.. literalinclude:: ../../examples/hello_publisher.py
    :language: python

:file:`hello_consumer.py`:

.. literalinclude:: ../../examples/hello_consumer.py
    :language: python


.. _task-queue-example:

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

:file:`client.py`:

.. literalinclude:: ../../examples/simple_task_queue/client.py