im looking to write a daemon that:
- reads a message from a queue (sqs, rabbit-mq, whatever ...) containing a path to a zip file
- updates a record in the database saying something like "this job is processing"
- reads the aforementioned archive's contents and inserts a row into a database w/ information culled from file meta data for each file found
- duplicates each file to s3
- deletes the zip file
- marks the job as "complete"
- read next message in queue, repeat
this should be running as a service, and initiated by a message queued when someone uploads a file via the web frontend. the uploader doesn't need to immediately see the results, but the upload be processed in the background fairly expediently.
im fluent with python, so the very first thing that comes to mind is writing a simple server with twisted to handle each request and carry out the process mentioned above. but, ive never written anything like this that would run in a multi-user context. its not going to service hundreds of uploads per minute or hour, but it'd be nice if it could handle several at a time, reasonable. i also am not terribly familiar with writing multi-threaded applications and dealing with issues like blocking.
how have people solved this in the past? what are some other approaches i could take?
thanks in advance for any help and discussion!