Support » Plugins » Handling Background Tasks With WordPress

  • I’m working on a WordPress installation that will be used for video (mp4) and audio (mp3) podcasting. Here are the requirements:

    * Metadata from an episode post is auto-injected into the mp4 and mp3 files
    * The files are stored on Amazon S3
    * The post is set to draft until the media is loaded to S3 and ready to serve, at which time the post is set to published.

    So, I’m thinking that the meta data and attachments can be handled by something like Flutter or Magic-Fields (Flutter fork). I’m just looking for a little guidance on the background processing, S3 posting, and post status updating.

    Coming from a Ruby background, job queues are a pretty popular topic. I’m thinking that a job queue would work well for what I’m trying to accomplish. I could see it working thus:

    * A WordPress plugin creates a new db table (i.e. wp_jobs)
    * When a new episode is posted, two jobs are added to the wp_jobs table (one for the audio, one for the video)
    * A background task runs periodically to check the wp_jobs table for jobs and executes them.
    * Once a job is completed (meta data injected into the file) the file is uploaded to S3, deleted from the queue, and (if all other jobs for the post are completed), the post’s status is set to published.

    So, here are my questions before starting on this quest—this will be my first WordPress plugin đŸ™‚

    1. Does a WordPress background queue plugin already exist? I searched but couldn’t find one.
    2. What would be the best way to schedule a job runner that would run inside the WordPress environment, but that wouldn’t lock the server while it was running?
    3. What would be the easiest way to interact with the post to update its status once the jobs are done?

    Thanks for any help!

Viewing 1 replies (of 1 total)
  • I don’t know how you got on but Zend has a useful queue class that can process job queues in the way you specified – it can even use amazon SQS.

    If you have got somewhere, I’m trying to accomplish same thing so would be interested in progress.

Viewing 1 replies (of 1 total)
  • The topic ‘Handling Background Tasks With WordPress’ is closed to new replies.