After a user submitted data to my app, I’d like to write to the
database asynchronously, possibly through a message queue.
How do I set up such a system? Are there any pluggable Django apps
that do such message queue-based database writes?
Also how do i handle errors that happens during the async processing?
Would really appreciate any pointers you can give me. Thank you.
Celery as a queue mechanism with a processor on the back end. It’s one of the simpler setups, and very effective. You can back it with persistence, or not, as you need. There’s a good walk through on setting it with django up on the website as well. Typically you’ll run a queue processor as a daemon, import the model bits from Django if you’re using those, and do the updates/inserts/etc as you need.
The documentation includes an example of processing a serial task that you can use as a template.