lucasnadalutti
lucasnadalutti

Reputation: 5948

Getting queue where task came from

I have a Celery application with 2 queues in which tasks of a given class (say, MyTask) are consumed round-robin. Some instances of MyTask are routed to the first queue, while other instances go to the second one.

Sometimes, a task needs to instantiate another object of MyTask and invoke apply_async again. Plus, the new task MUST be routed to the same queue as the one that is invoking it.

Problem is, I couldn't find in Celery's docs a way to get the queue from which the first task was consumed. Is there a straightforward, clean way of doing this?

Upvotes: 1

Views: 35

Answers (1)

Carlos Hernando
Carlos Hernando

Reputation: 319

See delivery_info on Task context.

Upvotes: 1

Related Questions