[Python] Questions about the role of routing_key in using Redis as a celery message broker

Discussão em 'Python' iniciado por Stack, Março 12, 2025.

  1. Stack

    Stack Membro Participativo

    [celery_config.py]

    task_queues = (
    Queue( 'test_queue',
    exchange=Exchange('test_queue', type='topic'),
    routing_key='test_queue.*' ),
    )

    task_routes = {
    'game.tasks.add':
    { 'queue': 'test_queue',
    'exchange' : 'test_queue',
    'exchange_type' : 'topic',
    'routing_key' : 'test_queue.add',
    'serializer' : 'json' },
    'game.tasks.mul': {
    'queue': 'test_queue',
    'exchange' : 'test_queue',
    'exchange_type' : 'topic',
    'routing_key' : 'onetwothree',
    'serializer' : 'json' },
    }


    I think the mul task should not come into test_queue due to celery settings. But this comes in. (Due to routing_key) I want to know the cause.

    If type is direct, it works as I want. Is it a problem with topic exchange_type?

    Continue reading...

Compartilhe esta Página