Bj gem/plugin

Has anyone successfully used the Bj
(http://agilewebdevelopment.com/plugins/bj) gem or plugin using JRuby?
If not, what’s everyone in JRuby land using for background processes?

Rich

ƃuɐlɐuɐɯ ɥɔıɹ

On Thu, Jun 26, 2008 at 11:09 PM, Rich M.
[email protected] wrote:

Has anyone successfully used the Bj
(http://agilewebdevelopment.com/plugins/bj) gem or plugin using JRuby?
If not, what’s everyone in JRuby land using for background processes?

I’d be interested to hear if BJ works with JRuby.

We don’t have a good background story yet but I’m working on a simple
extension in JRuby-Rack to allow registering asynchronous in-app JMS
listeners written in Ruby. The idea is that the JMS listener would
work similar to a Rails request in that it would reserve an
application runtime from the runtime pool and dispatch to the listener
object inside the runtime.

I don’t have all the API flushed out yet, but you can follow the work
here:

Let me know if you think of a use case that could be covered by this
and help me design for it.

/Nick


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

I’m kind of in the heat of patching Bj to get it to work on JRuby. So
far the main problem is that it doesn’t reference ar-jdbc. After
adding ar-jdbc, I’m finding other issues. I’ll let you know what I
come up with.

I like the idea of using JMS the way you describe below, but I’m not a
big fan of JRuby only solutions. What do you think about fixing Bj to
use JMS when running under JRuby? :slight_smile:

Rich

ƃuɐlɐuɐɯ ɥɔıɹ

Not yet. Although, this project may be dead in the water since I see
references to ObjectSpace in Bj. Now looking for a different option.
I don’t like rufus-scheduler because it doesn’t have a persistent
store for jobs – if the app goes down, you’ll never know what
happened to the jobs. Although, I’d love to hear from those who have
had success with rufus-scheduler… I saw that that several JRubyists
have.

Rich

ƃuɐlɐuɐɯ ɥɔıɹ

On Sat, Jun 28, 2008 at 10:06 PM, Stephen B.

I initially also planned to use bj in one project but now found
BackgroundFu (GitHub - ncr/background-fu: Running Long Background Tasks In Ruby On Rails Made Dead Simple) which I like better
than
bj.
Have not tried it yet with JRuby but at least from source code it seems
that it should probably run on it as there is no native process
launching
as in case of bj.

Raimonds

At 10:03 PM -0700 6/26/08, Rich M. wrote:

I’m kind of in the heat of patching Bj to get it to work on JRuby. So
far the main problem is that it doesn’t reference ar-jdbc. After
adding ar-jdbc, I’m finding other issues. I’ll let you know what I
come up with.

Rick, I started using Bj in a rails project recently and found it
doesn’t work in JRuby. Fixing it was on my list.

I’m interested in your progress and perhaps could help.

Ar you committing your work to any public repository (github)?


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Hi Nick. I checked out your JMS branch and I’m trying to run the sample
rails app with the JMS test. I realized that I needed to compile
jruby-rack
so I followed your notes, but got the following error:

[~/dev/jruby-rack(jms)] jruby -S buildr package
(in /Users/richmanalang/dev/jruby-rack, development)
Building jruby-rack
Running tests in jruby-rack
Running java org.jruby.Main
/Users/richmanalang/lib/jruby/lib/ruby/site_ruby/1.8/builtin/javasupport.rb:43:in
require': IO error -- builtin/java/collections (LoadError) from /Users/richmanalang/lib/jruby/lib/ruby/site_ruby/1.8/builtin/javasupport.rb:43 from /Users/richmanalang/lib/jruby/lib/ruby/site_ruby/1.8/builtin/javasupport.rb:3:inrequire’
from /Users/richmanalang/dev/jruby-rack/target/spec/runner.rb:3
[Failed] Your build failed with an error:
/Users/richmanalang/dev/jruby-rack:
Failed to execute java org.jruby.Main, see errors above
buildr aborted!
Failed to execute java org.jruby.Main, see errors above

(See full trace by running task with --trace)

I can’t figure out why it’s having a problem loading those files. Any
ideas?

Rich

At 10:20 AM +0300 6/30/08, Raimonds Simanovskis wrote:

I initially also planned to use bj in one
project but now found BackgroundFu
(http://github.com/ncr/background-fuGitHub - ncr/background-fu: Running Long Background Tasks In Ruby On Rails Made Dead Simple)
which I like better than bj.
Have not tried it yet with JRuby but at least
from source code it seems that it should
probably run on it as there is no native process
launching as in case of bj.

background_fu uses the daemons gem which uses
fork which is only experimentally supported in
jruby

$ bin/jruby -J-Djruby.fork.enabled=true -e ‘puts “hello”’
WARNING: fork is highly unlikely to be safe or stable on the JVM. Have
fun!
hello

I don’t know what makes fork so problematic on
JRuby except that the JVM (which is what gets
forked) could be a very large process and it’s a
heavyweight way to achieve something that could
be done in just another thread.

from daemons-1.0.9/lib/daemons.rb:

From a technical aspect of view, daemons does

the following when creating a daemon:

1. Forks a child (and exits the parent process, if needed)

2. Becomes a session leader (which detaches the program from

the controlling terminal).

3. Forks another child process and exits first child. This prevents

the potential of acquiring a controlling terminal.

4. Changes the current working directory to “/”.

5. Clears the file creation mask (sets +umask+ to +0000+).

6. Closes file descriptors (reopens +STDOUT+

and +STDERR+ to point to a logfile if

possible).

On Fri, Oct 24, 2008 at 1:56 PM, Rich M. [email protected]
wrote:

`require’: IO error – builtin/java/collections (LoadError)
Failed to execute java org.jruby.Main, see errors above

(See full trace by running task with --trace)

I can’t figure out why it’s having a problem loading those files. Any
ideas?

Hi Rich, I rebased the jms branch and pushed it. It’s building fine
for me using my jruby-buildr standalone package (see
http://wiki.jruby.org/wiki/JRuby_Rack#Building). What versions of
JRuby and/or build are you using?

/Nick


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email