Documentation
¶
Overview ¶
Package redis implements a Celery broker using Redis.
Index ¶
Constants ¶
const DefaultReceiveTimeout = 5
DefaultReceiveTimeout defines how many seconds the broker's Receive command should block waiting for results from Redis. Larger the timeout, longer the client will have to wait for Celery app to exit.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Broker ¶
type Broker struct {
// contains filtered or unexported fields
}
Broker is a Redis broker that sends/receives messages from specified queues.
func (*Broker) Observe ¶
Observe sets the queues from which the tasks should be received. Note, the method is not concurrency safe.
func (*Broker) Receive ¶
Receive fetches a Celery task message from a tail of one of the queues in Redis. After a timeout it returns nil, nil.
Celery relies on BRPOP command to process messages fairly, see https://github.com/celery/kombu/issues/166. Redis BRPOP is a blocking list pop primitive. It blocks the connection when there are no elements to pop from any of the given lists. An element is popped from the tail of the first list that is non-empty, with the given keys being checked in the order that they are given, see https://redis.io/commands/brpop/.
Note, the method is not concurrency safe.