'How to listen to already existing SQS queue with Celery and Django?
I want to listen to an existing SQS queue through Celery. I have already done publishing to Queue via celery and then consuming from that queue through workers and tasks bound to that queue. However, I am unable to figure out how to consume from an SQS queue if the publisher is a non-celery Django application. There is no such information available on the internet regarding this or at least I am unable to locate it. Can someone please guide me to some documentation for doing this?
Solution 1:[1]
If I understood correctly what you want to do I have bad news for you - it is not possible. Celery can only consume own messages. If your Django application needs to send some task to the Celery cluster using SQS as broker, it needs to instantiate a Celery application object, and use it to send tasks.
Solution 2:[2]
I would not use Celery. I would use boto3
directly, in a custom Django management command, to long-poll the queue and parse / route the incoming messages.
Celery would give you nothing, and would only increase the complexity of implementation.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | DejanLekic |
Solution 2 | threewordphrase |