<h1 dir="auto">Checklist</h1>

<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have verified that the issue exists against the <code class="notranslate">master</code> branch of Celery.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> This has already been asked to the <a href="https://groups.google.com/forum/#!forum/celery-users" rel="nofollow">discussion group</a> first.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have read the relevant section in the<br>
<a href="http://docs.celeryproject.org/en/latest/contributing.html#other-bugs" rel="nofollow">contribution guide</a><br>
on reporting bugs.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have checked the <a href="https://github.com/celery/celery/issues?q=is%3Aissue+label%3A%22Issue+Type%3A+Bug+Report%22+-label%3A%22Category%3A+Documentation%22">issues list</a><br>
for similar or identical bug reports.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have checked the <a href="https://github.com/celery/celery/pulls?q=is%3Apr+label%3A%22PR+Type%3A+Bugfix%22+-label%3A%22Category%3A+Documentation%22">pull requests list</a><br>
for existing proposed fixes.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have checked the <a href="https://github.com/celery/celery/commits/master">commit log</a><br>
to find out if the bug was already fixed in the master branch.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have included all related issues and possible duplicate issues<br>
in this issue (If there are none, check this box anyway).</li>
</ul>
<h2 dir="auto">Mandatory Debugging Information</h2>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have included the output of <code class="notranslate">celery -A proj report</code> in the issue.<br>
(if you are not able to do this, then at least specify the Celery<br>
version affected).</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have verified that the issue exists against the <code class="notranslate">master</code> branch of Celery.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have included the contents of <code class="notranslate">pip freeze</code> in the issue.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have included all the versions of all the external dependencies required<br>
to reproduce this bug.</li>
</ul>
<h2 dir="auto">Environment &amp; Settings</h2>

<p dir="auto"><strong>Celery version</strong>: 4.4.7</p>

<details>
<summary><b><code class="notranslate">celery report</code> Output:</b></summary>
<p dir="auto">
</p><div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="celery -A backend.celery_app:app report

software -&gt; celery:4.4.7 (cliffs) kombu:4.6.11 py:3.8.5
            billiard:3.6.3.0 redis:3.5.3
platform -&gt; system:Linux arch:64bit
            kernel version:4.15.0-112-generic imp:CPython
loader   -&gt; celery.loaders.app.AppLoader
settings -&gt; transport:redis results:redis://redis:6379/2

broker_url: 'redis://redis:6379/1'
result_backend: 'redis://redis:6379/2'
accpet_content: ['application/json']
task_serializer: 'json'
result_serializer: 'json'
task_acks_late: True
task_default_queue: 'default'
worker_send_task_events: True
worker_prefetch_multiplier: 1
task_queues: 
    (&lt;unbound Queue default -&gt; &lt;unbound Exchange default(direct)&gt; -&gt; default&gt;,
 &lt;unbound Queue other -&gt; &lt;unbound Exchange other(direct)&gt; -&gt; other&gt;)
task_routes: {
    'core.tasks.debug_task': {   'exchange': 'default',
                                 'queue': 'default',
                                 'routing_key': '********'},
    'core.tasks.debug_task_other': {   'exchange': 'other',
                                       'queue': 'other',
                                       'routing_key': '********'}}
task_default_exchange_type: 'direct'"><pre class="notranslate"><code class="notranslate">celery -A backend.celery_app:app report

software -&gt; celery:4.4.7 (cliffs) kombu:4.6.11 py:3.8.5
            billiard:3.6.3.0 redis:3.5.3
platform -&gt; system:Linux arch:64bit
            kernel version:4.15.0-112-generic imp:CPython
loader   -&gt; celery.loaders.app.AppLoader
settings -&gt; transport:redis results:redis://redis:6379/2

broker_url: 'redis://redis:6379/1'
result_backend: 'redis://redis:6379/2'
accpet_content: ['application/json']
task_serializer: 'json'
result_serializer: 'json'
task_acks_late: True
task_default_queue: 'default'
worker_send_task_events: True
worker_prefetch_multiplier: 1
task_queues: 
    (&lt;unbound Queue default -&gt; &lt;unbound Exchange default(direct)&gt; -&gt; default&gt;,
 &lt;unbound Queue other -&gt; &lt;unbound Exchange other(direct)&gt; -&gt; other&gt;)
task_routes: {
    'core.tasks.debug_task': {   'exchange': 'default',
                                 'queue': 'default',
                                 'routing_key': '********'},
    'core.tasks.debug_task_other': {   'exchange': 'other',
                                       'queue': 'other',
                                       'routing_key': '********'}}
task_default_exchange_type: 'direct'
</code></pre></div>
<p dir="auto"></p>
</details>
<h3 dir="auto">Python Packages</h3>

<details>
<summary><b><code class="notranslate">pip freeze</code> Output:</b></summary>
<p dir="auto">
</p><div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="amqp==2.6.1
appdirs==1.4.4
argh==0.26.2
argon2-cffi==20.1.0
asgiref==3.2.10
atomicwrites==1.4.0
attrs==20.1.0
backcall==0.2.0
billiard==3.6.3.0
black==19.10b0
bleach==3.1.5
celery==4.4.7
cffi==1.14.2
click==7.1.2
decorator==4.4.2
defusedxml==0.6.0
Django==3.1
django-debug-toolbar==2.2
django-extensions==3.0.5
entrypoints==0.3
factory-boy==2.11.1
Faker==4.1.2
gunicorn==20.0.4
ipykernel==5.3.4
ipython==7.17.0
ipython-genutils==0.2.0
ipywidgets==7.5.1
jedi==0.17.2
Jinja2==2.11.2
jsonschema==3.2.0
jupyter==1.0.0
jupyter-client==6.1.6
jupyter-console==6.1.0
jupyter-core==4.6.3
kombu==4.6.11
MarkupSafe==1.1.1
mistune==0.8.4
more-itertools==8.4.0
nbconvert==5.6.1
nbformat==5.0.7
notebook==6.1.3
packaging==20.4
pandocfilters==1.4.2
parso==0.7.1
pathspec==0.8.0
pathtools==0.1.2
pexpect==4.8.0
pickleshare==0.7.5
pluggy==0.13.1
prometheus-client==0.8.0
prompt-toolkit==3.0.6
psycopg2-binary==2.8.5
ptyprocess==0.6.0
py==1.9.0
pycparser==2.20
Pygments==2.6.1
pyparsing==2.4.7
pyrsistent==0.16.0
pytest==4.4.1
pytest-django==3.4.8
python-dateutil==2.8.1
pytz==2020.1
PyYAML==5.3.1
pyzmq==19.0.2
qtconsole==4.7.6
QtPy==1.9.0
redis==3.5.3
regex==2020.7.14
Send2Trash==1.5.0
six==1.15.0
sqlparse==0.3.1
terminado==0.8.3
testpath==0.4.4
text-unidecode==1.3
toml==0.10.1
tornado==6.0.4
traitlets==4.3.3
typed-ast==1.4.1
vine==1.3.0
watchdog==0.10.3
wcwidth==0.2.5
webencodings==0.5.1
widgetsnbextension==3.5.1"><pre class="notranslate"><code class="notranslate">amqp==2.6.1
appdirs==1.4.4
argh==0.26.2
argon2-cffi==20.1.0
asgiref==3.2.10
atomicwrites==1.4.0
attrs==20.1.0
backcall==0.2.0
billiard==3.6.3.0
black==19.10b0
bleach==3.1.5
celery==4.4.7
cffi==1.14.2
click==7.1.2
decorator==4.4.2
defusedxml==0.6.0
Django==3.1
django-debug-toolbar==2.2
django-extensions==3.0.5
entrypoints==0.3
factory-boy==2.11.1
Faker==4.1.2
gunicorn==20.0.4
ipykernel==5.3.4
ipython==7.17.0
ipython-genutils==0.2.0
ipywidgets==7.5.1
jedi==0.17.2
Jinja2==2.11.2
jsonschema==3.2.0
jupyter==1.0.0
jupyter-client==6.1.6
jupyter-console==6.1.0
jupyter-core==4.6.3
kombu==4.6.11
MarkupSafe==1.1.1
mistune==0.8.4
more-itertools==8.4.0
nbconvert==5.6.1
nbformat==5.0.7
notebook==6.1.3
packaging==20.4
pandocfilters==1.4.2
parso==0.7.1
pathspec==0.8.0
pathtools==0.1.2
pexpect==4.8.0
pickleshare==0.7.5
pluggy==0.13.1
prometheus-client==0.8.0
prompt-toolkit==3.0.6
psycopg2-binary==2.8.5
ptyprocess==0.6.0
py==1.9.0
pycparser==2.20
Pygments==2.6.1
pyparsing==2.4.7
pyrsistent==0.16.0
pytest==4.4.1
pytest-django==3.4.8
python-dateutil==2.8.1
pytz==2020.1
PyYAML==5.3.1
pyzmq==19.0.2
qtconsole==4.7.6
QtPy==1.9.0
redis==3.5.3
regex==2020.7.14
Send2Trash==1.5.0
six==1.15.0
sqlparse==0.3.1
terminado==0.8.3
testpath==0.4.4
text-unidecode==1.3
toml==0.10.1
tornado==6.0.4
traitlets==4.3.3
typed-ast==1.4.1
vine==1.3.0
watchdog==0.10.3
wcwidth==0.2.5
webencodings==0.5.1
widgetsnbextension==3.5.1
</code></pre></div>
<p dir="auto"></p>
</details>
<h2 dir="auto">Minimally Reproducible Test Case</h2>
<p dir="auto">Here is a fully reproducible example: <a href="https://gitlab.com/verbose-equals-true/digital-ocean-docker-swarm" rel="nofollow">https://gitlab.com/verbose-equals-true/digital-ocean-docker-swarm</a> that can be setup with docker-compose. Run <code class="notranslate">docker-compose up</code> to start it.</p>
<p dir="auto">I am using celery with Django and redis as the broker. I'm trying to setup two queues: <code class="notranslate">default</code> and <code class="notranslate">other</code>. My tasks are working, but the settings I have configured are not working have I am expecting them to work.</p>
<h1 dir="auto">Actual Behavior</h1>
<p dir="auto">I'm having two related issues:</p>
<ol dir="auto">
<li><strong>celery tasks are not respecting the <code class="notranslate">task_routes</code> setting (see below).</strong></li>
<li><strong>all of the celery tasks (no matter how they are defined) are registered to each of the two queues when they are started</strong></li>
</ol>
<p dir="auto">Here are the relevant parts of my code:</p>
<ol dir="auto">
<li>the celery app definition file</li>
<li>task definitions/declarations</li>
<li>commands to start workers</li>
</ol>
<p dir="auto">celery app definition:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="from celery import Celery
from django.conf import settings

from kombu import Exchange, Queue

CELERY_QUEUE_DEFAULT = 'default'
CELERY_QUEUE_OTHER = 'other'

app = Celery('backend')
app.conf[&quot;broker_url&quot;] = f&quot;redis://{settings.REDIS_SERVICE_HOST}:6379/1&quot;
app.conf[&quot;result_backend&quot;] = f&quot;redis://{settings.REDIS_SERVICE_HOST}:6379/2&quot;
app.conf[&quot;accpet_content&quot;] = ['application/json']
app.conf[&quot;task_serializer&quot;] = 'json'
app.conf[&quot;result_serializer&quot;] = 'json'
app.conf[&quot;task_acks_late&quot;] = True
app.conf[&quot;task_default_queue&quot;] = CELERY_QUEUE_DEFAULT
app.conf[&quot;worker_send_task_events&quot;] = True
app.conf[&quot;worker_prefetch_multiplier&quot;] = 1
app.conf[&quot;task_queues&quot;] = (
    Queue(
        CELERY_QUEUE_DEFAULT,
        Exchange(CELERY_QUEUE_DEFAULT),
        routing_key=CELERY_QUEUE_DEFAULT,
    ),
    Queue(
        CELERY_QUEUE_OTHER,
        Exchange(CELERY_QUEUE_OTHER),
        routing_key=CELERY_QUEUE_OTHER,
    ),
)
app.conf[&quot;task_routes&quot;] = {
    'backend.core.tasks.debug_task': {
        'queue': 'default',
        'routing_key': 'default',
        'exchange': 'default',
    },
    'backend.core.tasks.debug_task_other': {
        'queue': 'other',
        'routing_key': 'other',
        'exchange': 'other',
    },
}
app.conf[&quot;task_default_exchange_type&quot;] = 'direct'

app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)"><pre class="notranslate"><span class="pl-k">from</span> <span class="pl-s1">celery</span> <span class="pl-k">import</span> <span class="pl-v">Celery</span>
<span class="pl-k">from</span> <span class="pl-s1">django</span>.<span class="pl-s1">conf</span> <span class="pl-k">import</span> <span class="pl-s1">settings</span>

<span class="pl-k">from</span> <span class="pl-s1">kombu</span> <span class="pl-k">import</span> <span class="pl-v">Exchange</span>, <span class="pl-v">Queue</span>

<span class="pl-v">CELERY_QUEUE_DEFAULT</span> <span class="pl-c1">=</span> <span class="pl-s">'default'</span>
<span class="pl-v">CELERY_QUEUE_OTHER</span> <span class="pl-c1">=</span> <span class="pl-s">'other'</span>

<span class="pl-s1">app</span> <span class="pl-c1">=</span> <span class="pl-v">Celery</span>(<span class="pl-s">'backend'</span>)
<span class="pl-s1">app</span>.<span class="pl-s1">conf</span>[<span class="pl-s">"broker_url"</span>] <span class="pl-c1">=</span> <span class="pl-s">f"redis://<span class="pl-s1"><span class="pl-kos">{</span><span class="pl-s1">settings</span>.<span class="pl-v">REDIS_SERVICE_HOST</span><span class="pl-kos">}</span></span>:6379/1"</span>
<span class="pl-s1">app</span>.<span class="pl-s1">conf</span>[<span class="pl-s">"result_backend"</span>] <span class="pl-c1">=</span> <span class="pl-s">f"redis://<span class="pl-s1"><span class="pl-kos">{</span><span class="pl-s1">settings</span>.<span class="pl-v">REDIS_SERVICE_HOST</span><span class="pl-kos">}</span></span>:6379/2"</span>
<span class="pl-s1">app</span>.<span class="pl-s1">conf</span>[<span class="pl-s">"accpet_content"</span>] <span class="pl-c1">=</span> [<span class="pl-s">'application/json'</span>]
<span class="pl-s1">app</span>.<span class="pl-s1">conf</span>[<span class="pl-s">"task_serializer"</span>] <span class="pl-c1">=</span> <span class="pl-s">'json'</span>
<span class="pl-s1">app</span>.<span class="pl-s1">conf</span>[<span class="pl-s">"result_serializer"</span>] <span class="pl-c1">=</span> <span class="pl-s">'json'</span>
<span class="pl-s1">app</span>.<span class="pl-s1">conf</span>[<span class="pl-s">"task_acks_late"</span>] <span class="pl-c1">=</span> <span class="pl-c1">True</span>
<span class="pl-s1">app</span>.<span class="pl-s1">conf</span>[<span class="pl-s">"task_default_queue"</span>] <span class="pl-c1">=</span> <span class="pl-v">CELERY_QUEUE_DEFAULT</span>
<span class="pl-s1">app</span>.<span class="pl-s1">conf</span>[<span class="pl-s">"worker_send_task_events"</span>] <span class="pl-c1">=</span> <span class="pl-c1">True</span>
<span class="pl-s1">app</span>.<span class="pl-s1">conf</span>[<span class="pl-s">"worker_prefetch_multiplier"</span>] <span class="pl-c1">=</span> <span class="pl-c1">1</span>
<span class="pl-s1">app</span>.<span class="pl-s1">conf</span>[<span class="pl-s">"task_queues"</span>] <span class="pl-c1">=</span> (
    <span class="pl-v">Queue</span>(
        <span class="pl-v">CELERY_QUEUE_DEFAULT</span>,
        <span class="pl-v">Exchange</span>(<span class="pl-v">CELERY_QUEUE_DEFAULT</span>),
        <span class="pl-s1">routing_key</span><span class="pl-c1">=</span><span class="pl-v">CELERY_QUEUE_DEFAULT</span>,
    ),
    <span class="pl-v">Queue</span>(
        <span class="pl-v">CELERY_QUEUE_OTHER</span>,
        <span class="pl-v">Exchange</span>(<span class="pl-v">CELERY_QUEUE_OTHER</span>),
        <span class="pl-s1">routing_key</span><span class="pl-c1">=</span><span class="pl-v">CELERY_QUEUE_OTHER</span>,
    ),
)
<span class="pl-s1">app</span>.<span class="pl-s1">conf</span>[<span class="pl-s">"task_routes"</span>] <span class="pl-c1">=</span> {
    <span class="pl-s">'backend.core.tasks.debug_task'</span>: {
        <span class="pl-s">'queue'</span>: <span class="pl-s">'default'</span>,
        <span class="pl-s">'routing_key'</span>: <span class="pl-s">'default'</span>,
        <span class="pl-s">'exchange'</span>: <span class="pl-s">'default'</span>,
    },
    <span class="pl-s">'backend.core.tasks.debug_task_other'</span>: {
        <span class="pl-s">'queue'</span>: <span class="pl-s">'other'</span>,
        <span class="pl-s">'routing_key'</span>: <span class="pl-s">'other'</span>,
        <span class="pl-s">'exchange'</span>: <span class="pl-s">'other'</span>,
    },
}
<span class="pl-s1">app</span>.<span class="pl-s1">conf</span>[<span class="pl-s">"task_default_exchange_type"</span>] <span class="pl-c1">=</span> <span class="pl-s">'direct'</span>

<span class="pl-s1">app</span>.<span class="pl-en">autodiscover_tasks</span>(<span class="pl-k">lambda</span>: <span class="pl-s1">settings</span>.<span class="pl-v">INSTALLED_APPS</span>)</pre></div>
<p dir="auto">Task definitions (defined in a file called <code class="notranslate">tasks.py</code> in an app called <code class="notranslate">core</code>:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import time

import celery

# from backend import celery_app as app
# from celery import shared_task
from celery.task import task
from django.conf import settings

# @celery.task &lt;-- I have seen these decorators in other example
# @app.task &lt;-- neither of these result in the tasks being sent to the correct queue
# @shared_task
@task(queue=&quot;default&quot;, exchange=&quot;default&quot;)
def debug_task():
    time.sleep(10)
    return &quot;Task is done.&quot;


@task(queue=&quot;other&quot;, exchange=&quot;other&quot;)
def debug_task_other():
    time.sleep(10)
    return &quot;Task is done for other queue.&quot;"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">time</span>

<span class="pl-k">import</span> <span class="pl-s1">celery</span>

<span class="pl-c"># from backend import celery_app as app</span>
<span class="pl-c"># from celery import shared_task</span>
<span class="pl-k">from</span> <span class="pl-s1">celery</span>.<span class="pl-s1">task</span> <span class="pl-k">import</span> <span class="pl-s1">task</span>
<span class="pl-k">from</span> <span class="pl-s1">django</span>.<span class="pl-s1">conf</span> <span class="pl-k">import</span> <span class="pl-s1">settings</span>

<span class="pl-c"># @celery.task &lt;-- I have seen these decorators in other example</span>
<span class="pl-c"># @app.task &lt;-- neither of these result in the tasks being sent to the correct queue</span>
<span class="pl-c"># @shared_task</span>
<span class="pl-en">@<span class="pl-en">task</span>(<span class="pl-s1">queue</span><span class="pl-c1">=</span><span class="pl-s">"default"</span>, <span class="pl-s1">exchange</span><span class="pl-c1">=</span><span class="pl-s">"default"</span>)</span>
<span class="pl-k">def</span> <span class="pl-en">debug_task</span>():
    <span class="pl-s1">time</span>.<span class="pl-en">sleep</span>(<span class="pl-c1">10</span>)
    <span class="pl-k">return</span> <span class="pl-s">"Task is done."</span>


<span class="pl-en">@<span class="pl-en">task</span>(<span class="pl-s1">queue</span><span class="pl-c1">=</span><span class="pl-s">"other"</span>, <span class="pl-s1">exchange</span><span class="pl-c1">=</span><span class="pl-s">"other"</span>)</span>
<span class="pl-k">def</span> <span class="pl-en">debug_task_other</span>():
    <span class="pl-s1">time</span>.<span class="pl-en">sleep</span>(<span class="pl-c1">10</span>)
    <span class="pl-k">return</span> <span class="pl-s">"Task is done for other queue."</span></pre></div>
<p dir="auto">Here's how I'm starting my workers in <code class="notranslate">docker-compose</code> locally:</p>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="  celery:
    &lt;&lt;: *backend
    container_name: celery
    command:
      - &quot;watchmedo&quot;
      - &quot;auto-restart&quot;
      - &quot;--directory=./&quot;
      - &quot;--pattern=*.py&quot;
      - &quot;--recursive&quot;
      - &quot;--&quot;
      - &quot;celery&quot;
      - &quot;worker&quot;
      - &quot;--app=backend.celery_app:app&quot;
      - &quot;-Q&quot;
      - &quot;default&quot;
      - &quot;--concurrency=1&quot;
      - &quot;--loglevel=INFO&quot;
    ports: []

  celery_other:
    &lt;&lt;: *backend
    container_name: celery_other
    command:
      - &quot;watchmedo&quot;
      - &quot;auto-restart&quot;
      - &quot;--directory=./&quot;
      - &quot;--pattern=*.py&quot;
      - &quot;--recursive&quot;
      - &quot;--&quot;
      - &quot;celery&quot;
      - &quot;worker&quot;
      - &quot;--app=backend.celery_app:app&quot;
      - &quot;-Q&quot;
      - &quot;other&quot;
      - &quot;--concurrency=1&quot;
      - &quot;--loglevel=INFO&quot;
    ports: []"><pre class="notranslate">  <span class="pl-ent">celery</span>:
    <span class="pl-ent">&lt;&lt;</span>: <span class="pl-s">*backend</span>
    <span class="pl-ent">container_name</span>: <span class="pl-s">celery</span>
    <span class="pl-ent">command</span>:
      - <span class="pl-s"><span class="pl-pds">"</span>watchmedo<span class="pl-pds">"</span></span>
      - <span class="pl-s"><span class="pl-pds">"</span>auto-restart<span class="pl-pds">"</span></span>
      - <span class="pl-s"><span class="pl-pds">"</span>--directory=./<span class="pl-pds">"</span></span>
      - <span class="pl-s"><span class="pl-pds">"</span>--pattern=*.py<span class="pl-pds">"</span></span>
      - <span class="pl-s"><span class="pl-pds">"</span>--recursive<span class="pl-pds">"</span></span>
      - <span class="pl-s"><span class="pl-pds">"</span>--<span class="pl-pds">"</span></span>
      - <span class="pl-s"><span class="pl-pds">"</span>celery<span class="pl-pds">"</span></span>
      - <span class="pl-s"><span class="pl-pds">"</span>worker<span class="pl-pds">"</span></span>
      - <span class="pl-s"><span class="pl-pds">"</span>--app=backend.celery_app:app<span class="pl-pds">"</span></span>
      - <span class="pl-s"><span class="pl-pds">"</span>-Q<span class="pl-pds">"</span></span>
      - <span class="pl-s"><span class="pl-pds">"</span>default<span class="pl-pds">"</span></span>
      - <span class="pl-s"><span class="pl-pds">"</span>--concurrency=1<span class="pl-pds">"</span></span>
      - <span class="pl-s"><span class="pl-pds">"</span>--loglevel=INFO<span class="pl-pds">"</span></span>
    <span class="pl-ent">ports</span>: <span class="pl-s">[]</span>

  <span class="pl-ent">celery_other</span>:
    <span class="pl-ent">&lt;&lt;</span>: <span class="pl-s">*backend</span>
    <span class="pl-ent">container_name</span>: <span class="pl-s">celery_other</span>
    <span class="pl-ent">command</span>:
      - <span class="pl-s"><span class="pl-pds">"</span>watchmedo<span class="pl-pds">"</span></span>
      - <span class="pl-s"><span class="pl-pds">"</span>auto-restart<span class="pl-pds">"</span></span>
      - <span class="pl-s"><span class="pl-pds">"</span>--directory=./<span class="pl-pds">"</span></span>
      - <span class="pl-s"><span class="pl-pds">"</span>--pattern=*.py<span class="pl-pds">"</span></span>
      - <span class="pl-s"><span class="pl-pds">"</span>--recursive<span class="pl-pds">"</span></span>
      - <span class="pl-s"><span class="pl-pds">"</span>--<span class="pl-pds">"</span></span>
      - <span class="pl-s"><span class="pl-pds">"</span>celery<span class="pl-pds">"</span></span>
      - <span class="pl-s"><span class="pl-pds">"</span>worker<span class="pl-pds">"</span></span>
      - <span class="pl-s"><span class="pl-pds">"</span>--app=backend.celery_app:app<span class="pl-pds">"</span></span>
      - <span class="pl-s"><span class="pl-pds">"</span>-Q<span class="pl-pds">"</span></span>
      - <span class="pl-s"><span class="pl-pds">"</span>other<span class="pl-pds">"</span></span>
      - <span class="pl-s"><span class="pl-pds">"</span>--concurrency=1<span class="pl-pds">"</span></span>
      - <span class="pl-s"><span class="pl-pds">"</span>--loglevel=INFO<span class="pl-pds">"</span></span>
    <span class="pl-ent">ports</span>: <span class="pl-s">[]</span></pre></div>
<p dir="auto">Here are the logs from <code class="notranslate">docker-compose</code> that show that the two tasks are both registered to each worker:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="celery             |  
celery             |  -------------- celery@c8f0ed3f97df v4.4.7 (cliffs)
celery             | --- ***** ----- 
celery             | -- ******* ---- Linux-4.15.0-112-generic-x86_64-with-glibc2.2.5 2020-08-21 20:35:47
celery             | - *** --- * --- 
celery             | - ** ---------- [config]
celery             | - ** ---------- .&gt; app:         backend:0x7fb327c2e6a0
celery             | - ** ---------- .&gt; transport:   redis://redis:6379/1
celery             | - ** ---------- .&gt; results:     redis://redis:6379/2
celery             | - *** --- * --- .&gt; concurrency: 1 (prefork)
celery             | -- ******* ---- .&gt; task events: ON
celery             | --- ***** ----- 
celery             |  -------------- [queues]
celery             |                 .&gt; default          exchange=default(direct) key=default
celery             |                 
celery             | 
celery             | [tasks]
celery             |   . core.tasks.debug_task
celery             |   . core.tasks.debug_task_other
celery             | 
celery_other       |  
celery_other       |  -------------- celery@3dd99b1ed32e v4.4.7 (cliffs)
celery_other       | --- ***** ----- 
celery_other       | -- ******* ---- Linux-4.15.0-112-generic-x86_64-with-glibc2.2.5 2020-08-21 20:35:47
celery_other       | - *** --- * --- 
celery_other       | - ** ---------- [config]
celery_other       | - ** ---------- .&gt; app:         backend:0x7f54fa89e6a0
celery_other       | - ** ---------- .&gt; transport:   redis://redis:6379/1
celery_other       | - ** ---------- .&gt; results:     redis://redis:6379/2
celery_other       | - *** --- * --- .&gt; concurrency: 1 (prefork)
celery_other       | -- ******* ---- .&gt; task events: ON
celery_other       | --- ***** ----- 
celery_other       |  -------------- [queues]
celery_other       |                 .&gt; other            exchange=other(direct) key=other
celery_other       |                 
celery_other       | 
celery_other       | [tasks]
celery_other       |   . core.tasks.debug_task
celery_other       |   . core.tasks.debug_task_other"><pre class="notranslate"><code class="notranslate">celery             |  
celery             |  -------------- celery@c8f0ed3f97df v4.4.7 (cliffs)
celery             | --- ***** ----- 
celery             | -- ******* ---- Linux-4.15.0-112-generic-x86_64-with-glibc2.2.5 2020-08-21 20:35:47
celery             | - *** --- * --- 
celery             | - ** ---------- [config]
celery             | - ** ---------- .&gt; app:         backend:0x7fb327c2e6a0
celery             | - ** ---------- .&gt; transport:   redis://redis:6379/1
celery             | - ** ---------- .&gt; results:     redis://redis:6379/2
celery             | - *** --- * --- .&gt; concurrency: 1 (prefork)
celery             | -- ******* ---- .&gt; task events: ON
celery             | --- ***** ----- 
celery             |  -------------- [queues]
celery             |                 .&gt; default          exchange=default(direct) key=default
celery             |                 
celery             | 
celery             | [tasks]
celery             |   . core.tasks.debug_task
celery             |   . core.tasks.debug_task_other
celery             | 
celery_other       |  
celery_other       |  -------------- celery@3dd99b1ed32e v4.4.7 (cliffs)
celery_other       | --- ***** ----- 
celery_other       | -- ******* ---- Linux-4.15.0-112-generic-x86_64-with-glibc2.2.5 2020-08-21 20:35:47
celery_other       | - *** --- * --- 
celery_other       | - ** ---------- [config]
celery_other       | - ** ---------- .&gt; app:         backend:0x7f54fa89e6a0
celery_other       | - ** ---------- .&gt; transport:   redis://redis:6379/1
celery_other       | - ** ---------- .&gt; results:     redis://redis:6379/2
celery_other       | - *** --- * --- .&gt; concurrency: 1 (prefork)
celery_other       | -- ******* ---- .&gt; task events: ON
celery_other       | --- ***** ----- 
celery_other       |  -------------- [queues]
celery_other       |                 .&gt; other            exchange=other(direct) key=other
celery_other       |                 
celery_other       | 
celery_other       | [tasks]
celery_other       |   . core.tasks.debug_task
celery_other       |   . core.tasks.debug_task_other
</code></pre></div>
<p dir="auto">I was thinking that defining <code class="notranslate">task_routes</code> would mean that I don't have to specify the tasks's queue in the task decorator. If I don't specify the queue, the tasks are all picked up by the default worker.</p>
<p dir="auto">If it helps, here is my Django directory structure:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="tree -L 3 backend
backend
├── backend
│   ├── asgi.py
│   ├── celery_app.py &lt;- this is where I define my celery app
│   ├── __init__.py
│   ├── settings
│   │   ├── base.py
│   │   ├── development.py
│   │   ├── __init__.py
│   │   └── production.py
│   ├── settings.py
│   ├── urls.py
│   └── wsgi.py
├── core
│   ├── admin.py
│   ├── apps.py
│   ├── __init__.py
│   ├── migrations
│   │   └── __init__.py
│   ├── models.py
│   ├── tasks.py &lt;- this is where I define the tasks shown above
│   ├── tests.py
│   ├── urls.py
│   └── views.py
├── docker
│   ├── Dockerfile.dev
│   └── Dockerfile.prod
├── manage.py
└── requirements
    ├── base.txt
    ├── dev.txt
    └── test.txt"><pre class="notranslate"><code class="notranslate">tree -L 3 backend
backend
├── backend
│   ├── asgi.py
│   ├── celery_app.py &lt;- this is where I define my celery app
│   ├── __init__.py
│   ├── settings
│   │   ├── base.py
│   │   ├── development.py
│   │   ├── __init__.py
│   │   └── production.py
│   ├── settings.py
│   ├── urls.py
│   └── wsgi.py
├── core
│   ├── admin.py
│   ├── apps.py
│   ├── __init__.py
│   ├── migrations
│   │   └── __init__.py
│   ├── models.py
│   ├── tasks.py &lt;- this is where I define the tasks shown above
│   ├── tests.py
│   ├── urls.py
│   └── views.py
├── docker
│   ├── Dockerfile.dev
│   └── Dockerfile.prod
├── manage.py
└── requirements
    ├── base.txt
    ├── dev.txt
    └── test.txt
</code></pre></div>
<p dir="auto">I have tried to follow the <code class="notranslate">Routing Tasks</code> page from the celery documentation to get everything setup correctly: <a href="https://docs.celeryproject.org/en/stable/userguide/routing.html" rel="nofollow">https://docs.celeryproject.org/en/stable/userguide/routing.html</a></p>
<p dir="auto">it's duplicate of <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="324811646" data-permission-text="Title is private" data-url="https://github.com/celery/kombu/issues/870" data-hovercard-type="issue" data-hovercard-url="/celery/kombu/issues/870/hovercard" href="https://github.com/celery/kombu/issues/870">celery/kombu#870</a>, but in order to fix 4.1 I suggest creating a 4.1.1 release with kombu dependency set to <code class="notranslate">&gt;=4,1,&lt;4.2</code></p>