Background Processing

Hi,

I have an application that accepts XML files through an HTTP POST, and
then needs to process these files and send back a response. On some
larger file sizes, this processing isn't occurring quickly enough, and
the HTTP request times out on the client side. In addition to this,
the server could be receiving several of these files at the same time,
leaving several clients hanging. I have been doing some reading
regarding handling background processing, and was wondering if anybody
had any experience with it?

What I'm hoping to do is to receive the XML document, and then send
back a response to the client right away, before handling the
processing. In my reading I have seen that some possible solutions
might be to use ScriptRunner, or possibly to create a new Thread to
handle the processing. Does anybody have some advice on a good way to
handle this situation?

Thanks,

Simon

Personally, I wouldn’t go with either of those solutions… use Backgroundrb, this is exactly what it is built for… it interfaces seamlessly with Rails and will do exactly what you’re asking for. You can find out about it at: http://backgroundrb.rubyforge.org/

What you are looking for is backgroundrb.

http://brainspl.at/articles/tag/background

http://www.infoq.com/articles/BackgrounDRb

You create worker objects that go about business that you define for them. These workers can be initialised by user driven events such as the xml upload in your case, or periodically from the time when the backgroundrb server is started.

regards
ivor

I'm working on a system for stuff like this, but it's not quite ready yet.
Here's what I have to far.

  Cheers,
    Tyler

acts_as_queueable.rb (1.42 KB)

acts_as_queue.rb (5.56 KB)

018_create_queue_items.rb (834 Bytes)

queue_item.rb (81 Bytes)