你正在阅读 Celery 3.1 的文档。开发版本文档见: 此处.
The AMQP result backend.
This backend publishes results as messages.
Publishes results by sending messages.
Too much state history to fast-forward.
Message consumer.
参数: |
|
---|
Consumer does not allow this content-type.
Add a queue to the list of queues to consume from.
This will not start consuming from the queue, for that you will have to call consume() after.
This method is deprecated.
Instead please use:
consumer.add_queue(Queue.from_dict(d))
End all active queue consumers.
This does not affect already delivered messages, but it does mean the server will not send any more messages for this consumer.
Cancel consumer by queue name.
End all active queue consumers.
This does not affect already delivered messages, but it does mean the server will not send any more messages for this consumer.
Start consuming messages.
Can be called multiple times, but note that while it will consume from new queues added since the last call, it will not cancel consuming from removed queues ( use cancel_by_queue()).
参数: | no_ack – See no_ack. |
---|
Return True if the consumer is currently consuming from queue’.
Declare queues, exchanges and bindings.
This is done automatically at instantiation if auto_declare is set.
Enable/disable flow from peer.
This is a simple flow-control mechanism that a peer can use to avoid overflowing its queues or otherwise finding itself receiving more messages than it can process.
The peer that receives a request to stop sending content will finish sending the current content (if any), and then wait until flow is reactivated.
Purge messages from all queues.
警告
This will delete all ready messages, there is no undo operation.
Specify quality of service.
The client can request that messages should be sent in advance so that when the client finishes processing a message, the following message is already held locally, rather than needing to be sent down the channel. Prefetching gives a performance improvement.
The prefetch window is Ignored if the no_ack option is set.
参数: |
|
---|
Method called when a message is received.
This dispatches to the registered callbacks.
参数: |
|
---|---|
引发 NotImplementedError: | |
If no consumer callbacks have been registered. |
Redeliver unacknowledged messages.
Asks the broker to redeliver all unacknowledged messages on the specified channel.
参数: | requeue – By default the messages will be redelivered to the original recipient. With requeue set to true, the server will attempt to requeue the message, potentially then delivering it to an alternative subscriber. |
---|
Register a new callback to be called when a message is received.
The signature of the callback needs to accept two arguments: (body, message), which is the decoded message body and the Message instance (a subclass of Message.
Revive consumer after connection loss.
An Exchange declaration.
参数: |
|
---|
Name of the exchange. Default is no name (the default exchange).
This description of AMQP exchange types was shamelessly stolen from the blog post `AMQP in 10 minutes: Part 4`_ by Rajith Attapattu. Reading this article is recommended if you’re new to amqp.
“AMQP defines four default exchange types (routing algorithms) that covers most of the common messaging use cases. An AMQP broker can also define additional exchange types, so see your broker manual for more information about available exchange types.
direct (default)
Direct match between the routing key in the message, and the routing criteria used when a queue is bound to this exchange.
topic
Wildcard match between the routing key and the routing pattern specified in the exchange/queue binding. The routing key is treated as zero or more words delimited by ”.” and supports special wildcard characters. “*” matches a single word and “#” matches zero or more words.
fanout
Queues are bound to this exchange with no arguments. Hence any message sent to this exchange will be forwarded to all queues bound to this exchange.
headers
Queues are bound to this exchange with a table of arguments containing headers and values (optional). A special argument named “x-match” determines the matching algorithm, where “all” implies an AND (all pairs must match) and “any” implies OR (at least one pair must match).
arguments is used to specify the arguments.
The channel the exchange is bound to (if bound).
Durable exchanges remain active when a server restarts. Non-durable exchanges (transient exchanges) are purged when a server restarts. Default is True.
If set, the exchange is deleted when all queues have finished using it. Default is False.
The default delivery mode used for messages. The value is an integer, or alias string.
1 or “transient”
The message is transient. Which means it is stored in memory only, and is lost if the server dies or restarts.
- 2 or “persistent” (default)
The message is persistent. Which means the message is stored both in-memory, and on disk, and therefore preserved if the server dies or restarts.
The default value is 2 (persistent).
Additional arguments to specify when the exchange is declared.
Create message instance to be sent with publish().
参数: |
|
---|
Binds the exchange to another exchange.
参数: | nowait – If set the server will not respond, and the call will not block waiting for a response. Default is False. |
---|
Declare the exchange.
Creates the exchange on the broker.
参数: | nowait – If set the server will not respond, and a response will not be waited for. Default is False. |
---|
Delete the exchange declaration on server.
参数: |
|
---|
Publish message.
参数: |
|
---|
Delete previously created exchange binding from the server.
Message Producer.
参数: |
|
---|
Declare the exchange.
This happens automatically at instantiation if auto_declare is enabled.
Declare the exchange if it hasn’t already been declared during this session.
Publish message to the specified exchange.
参数: |
|
---|
Revive the producer after connection loss.
NoCacheQueue 的别名
Reload group result, even if it has been previously fetched.
Send task return value and status.