Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

BUG: fix exchange routing #68

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

marek-mazur
Copy link

Creating tasks with custom routing key, when RabbitMq is empty should pass this parameter to bind properly newly created queue. But currently is not, so starting php apllication (before backend with celery) declares new exchange and queue with improper binding. In effect of that all new sent task are lost.

Example:

$celery = new Celery(...);

$taskName = 'someTaskName';
$taskData = ['lorem' => 'ipsum'];
$asyncResult = false;
$routingKey = 'someRoutingKey';

$celery->PostTask($taskName, $taskData, $asyncResult, $routingKey);

AMQPLibConnector.php

$ch->queue_bind(
    $details['binding'],    /* queue name - "celery" */
    $details['exchange'],   /* exchange name - "celery" */
    $details['routing_key'] // <--- Lost parameter !!!
);

@lexabug
Copy link
Contributor

lexabug commented Jan 15, 2018

AFAIK Python's Celery binds queues to exchanges using queue names as default routing key. When a task is posted to a broker a routing key may vary, which can lead it to different queues although it posted to the same exchange. Ideally, I think that all binding should be declared before posting any task to a queue and shouldn't be a part of the postTask() method.

See my pull request here #112.

@marek-mazur
Copy link
Author

Sure. But without that you cannot autocreate new queue on empty Rabbit. I think it should be possible with this lib as it is possible in python.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants