kombu

Django & Celery — Routing problems

非 Y 不嫁゛ 提交于 2019-12-02 17:35:12
I'm using Django and Celery and I'm trying to setup routing to multiple queues. When I specify a task's routing_key and exchange (either in the task decorator or using apply_async() ), the task isn't added to the broker (which is Kombu connecting to my MySQL database). If I specify the queue name in the task decorator (which will mean the routing key is ignored), the task works fine. It appears to be a problem with the routing/exchange setup. Any idea what the problem could be? Here's the setup: settings.py INSTALLED_APPS = ( ... 'kombu.transport.django', 'djcelery', ) BROKER_BACKEND = 'django

In-Memory broker for celery unit tests

狂风中的少年 提交于 2019-11-29 21:30:38
I have a REST API written in Django, with and endpoint that queues a celery task when posting to it. The response contains the task id which I'd like to use to test that the task is created and get the result. So, I'd like to do something like: def test_async_job(): response = self.client.post("/api/jobs/", some_test_data, format="json") task_id = response.data['task_id'] result = my_task.AsyncResult(task_id).get() self.assertEquals(result, ...) I obviously don't want to have to run a celery worker to run the unit tests, I expect to mock it somehow. I can't use CELERY_ALWAYS_EAGER because that

Celery with Amazon SQS

▼魔方 西西 提交于 2019-11-27 06:20:38
I want to use Amazon SQS as broker backed of Celery . There’s the SQS transport implementation for Kombu , which Celery depends on. However there is not enough documentation for using it, so I cannot find how to configure SQS on Celery. Is there somebody that had succeeded to configure SQS on Celery? I ran into this question several times but still wasn't entirely sure how to setup Celery to work with SQS. It turns out that it is quite easy with the latest versions of Kombu and Celery. As an alternative to the BROKER_URL syntax mentioned in another answer, you can simply set the transport,

Celery with Amazon SQS

懵懂的女人 提交于 2019-11-26 11:57:31
问题 I want to use Amazon SQS as broker backed of Celery. There’s the SQS transport implementation for Kombu, which Celery depends on. However there is not enough documentation for using it, so I cannot find how to configure SQS on Celery. Is there somebody that had succeeded to configure SQS on Celery? 回答1: I ran into this question several times but still wasn't entirely sure how to setup Celery to work with SQS. It turns out that it is quite easy with the latest versions of Kombu and Celery. As