Asynchronous Tasks HowTo

68 views
Skip to first unread message

Stratos Pavlakis

unread,
Sep 3, 2012, 5:14:50 PM9/3/12
to rails-t...@googlegroups.com
Hi all,

I am developing a JRuby app on Trinidad and I would like to handle some "expensive" requests, in an asynchronous manner.

This could simply be a separate thread on the server writing to an object in shared memory (application scope)
and a simple long polling request on the client that would get fed by this shared object by another controller. No need for fancy stuff like socket.io or EM-websockets.

As my application lives on a servlet container how do you think I should implement that? Using one of the standard RAILS libraries providing
background/asynchronous jobs or taking advantage of the Servlet 3.0's async request API? If the latter one, is there any doc describing how to write
a servlet inside a JRuby app?

I am really looking forward to some guidance towards this. Thanks!

kares

unread,
Sep 21, 2012, 8:14:33 AM9/21/12
to rails-t...@googlegroups.com

 Hey Stratos, sorry for the delay ...

Unfortunately this is not yet supported by JRuby-Rack and requires some work to be done.
The reason behind not being able to use this is most likely somewhere around no standard-waoy of doing Rack async responses.
But I do think there's an urgent need for it due Rails 4.0 since the way streaming responses are currently implemented is not optimal for JRuby (and esp. servlet containers).

It will take a while but I try to do my best to get this working (eventually).
Since there's an issue open on JRuby-Rack you can track it here: https://github.com/jruby/jruby-rack/issues/119

K.
Reply all
Reply to author
Forward
0 new messages