summaryrefslogtreecommitdiff
path: root/docs/reference/kombu.rst
blob: 46fceeaf2ee4107cc09e648007b1a80304cc0d8e (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
.. currentmodule:: kombu

.. contents::
    :local:

.. automodule:: kombu

    Connection
    ----------

    .. autoclass:: Connection

        .. admonition:: Attributes

            .. autoattribute:: hostname
            .. autoattribute:: port
            .. autoattribute:: userid
            .. autoattribute:: password
            .. autoattribute:: virtual_host
            .. autoattribute:: ssl
            .. autoattribute:: login_method
            .. autoattribute:: failover_strategy
            .. autoattribute:: connect_timeout
            .. autoattribute:: heartbeat

            .. autoattribute:: default_channel
            .. autoattribute:: connected
            .. autoattribute:: recoverable_connection_errors
            .. autoattribute:: recoverable_channel_errors
            .. autoattribute:: connection_errors
            .. autoattribute:: channel_errors
            .. autoattribute:: transport
            .. autoattribute:: connection
            .. autoattribute:: uri_prefix
            .. autoattribute:: declared_entities
            .. autoattribute:: more_to_read
            .. autoattribute:: cycle
            .. autoattribute:: host
            .. autoattribute:: manager
            .. autoattribute:: eventmap
            .. autoattribute:: supports_heartbeats
            .. autoattribute:: is_evented

        .. admonition:: Methods

            .. automethod:: as_uri
            .. automethod:: connect
            .. automethod:: channel
            .. automethod:: drain_events
            .. automethod:: drain_nowait
            .. automethod:: release
            .. automethod:: autoretry
            .. automethod:: ensure_connection
            .. automethod:: ensure
            .. automethod:: revive
            .. automethod:: create_transport
            .. automethod:: get_transport_cls
            .. automethod:: clone
            .. automethod:: info
            .. automethod:: switch
            .. automethod:: maybe_switch_next
            .. automethod:: heartbeat_check
            .. automethod:: maybe_close_channel
            .. automethod:: close
            .. automethod:: _close
            .. automethod:: completes_cycle
            .. automethod:: get_manager

            .. automethod:: Producer
            .. automethod:: Consumer
            .. automethod:: Pool
            .. automethod:: ChannelPool
            .. automethod:: SimpleQueue
            .. automethod:: SimpleBuffer

    Exchange
    --------

    Example creating an exchange declaration::

        >>> news_exchange = Exchange('news', type='topic')

    For now `news_exchange` is just a declaration, you can't perform
    actions on it. It just describes the name and options for the exchange.

    The exchange can be bound or unbound. Bound means the exchange is
    associated with a channel and operations can be performed on it.
    To bind the exchange you call the exchange with the channel as argument::

        >>> bound_exchange = news_exchange(channel)

    Now you can perform operations like :meth:`declare` or :meth:`delete`::

        >>> bound_exchange.declare()
        >>> message = bound_exchange.Message('Cure for cancer found!')
        >>> bound_exchange.publish(message, routing_key='news.science')
        >>> bound_exchange.delete()

    .. autoclass:: Exchange
        :members:
        :undoc-members:

        .. automethod:: maybe_bind

    Queue
    -----

    Example creating a queue using our exchange in the :class:`Exchange`
    example::

        >>> science_news = Queue('science_news',
        ...                      exchange=news_exchange,
        ...                      routing_key='news.science')

    For now `science_news` is just a declaration, you can't perform
    actions on it. It just describes the name and options for the queue.

    The queue can be bound or unbound. Bound means the queue is
    associated with a channel and operations can be performed on it.
    To bind the queue you call the queue instance with the channel as
    an argument::

        >>> bound_science_news = science_news(channel)

    Now you can perform operations like :meth:`declare` or :meth:`purge`:

    .. code-block:: python

        >>> bound_sicence_news.declare()
        >>> bound_science_news.purge()
        >>> bound_science_news.delete()

    .. autoclass:: Queue
        :members:
        :undoc-members:

        .. automethod:: maybe_bind

    Message Producer
    ----------------

    .. autoclass:: Producer

        .. autoattribute:: channel
        .. autoattribute:: exchange
        .. autoattribute:: routing_key
        .. autoattribute:: serializer
        .. autoattribute:: compression
        .. autoattribute:: auto_declare
        .. autoattribute:: on_return
        .. autoattribute:: connection

        .. automethod:: declare
        .. automethod:: maybe_declare
        .. automethod:: publish
        .. automethod:: revive

    Message Consumer
    ----------------

    .. autoclass:: Consumer

        .. autoattribute:: channel
        .. autoattribute:: queues
        .. autoattribute:: no_ack
        .. autoattribute:: auto_declare
        .. autoattribute:: callbacks
        .. autoattribute:: on_message
        .. autoattribute:: on_decode_error
        .. autoattribute:: connection

        .. automethod:: declare
        .. automethod:: register_callback
        .. automethod:: add_queue
        .. automethod:: add_queue_from_dict
        .. automethod:: consume
        .. automethod:: cancel
        .. automethod:: cancel_by_queue
        .. automethod:: consuming_from
        .. automethod:: purge
        .. automethod:: flow
        .. automethod:: qos
        .. automethod:: recover
        .. automethod:: receive
        .. automethod:: revive