Ruby WMQ.

Ruby interface into WebSphere MQ (MQSeries) ®

Ruby is now Enterprise Ready!


The one certainty in software development is that the software engineering landscape continuously changes.

When Sun hired the JRuby developers and focused many of it’s internal resources on Ruby, the software engineering landscape has changed significantly. We are privileged to see the merger of static and dynamic languages in a way unlike any other ever seen before.

JRuby allows Ruby programs to by run as-is on a Java Virtual Machine. Not only do Ruby programs running on JRuby have access to all the existing Ruby code, they can now natively access Java classes running in the same JVM.

JRuby is also the first portable implementation of Ruby that supplies real threads. We can now finally scale Ruby to unheard of levels of performance and scalability. Ruby is now Ready for the Large Enterprise .

Having written native ‘C’ extensions for the native/regular Ruby interpreter, it is clear that extending the Ruby language is very difficult and error prone. In JRuby, since Ruby can access Java classes directly it is very easy to extend Ruby with regular Java classes. The Java classes can now do the heavy lifting while Ruby focuses on being the glue.

The wealth of existing Java infrastructure is now immediately available to Ruby when running on JRuby. For example, since we can now deploy Ruby on Rails applications as war files, we can take advantage of existing application server features such as scalability and failover.

The folks that created JRuby did an outstanding job in achieving tremendous performance levels with the 1.0 release. They achieved enterprise level performance by compiling the Ruby code into JVM byte code. Well Done!!

Based on performance testing I have found that JRuby can outperform regular Ruby in server-side applications when the -O and JVM -server options are used.

To see JRuby in action, I took the Java MQ sample program that ships with WebSphere MQ and converted it to Ruby.

Original converted to Ruby running on JRuby V1.0

mq_test.rb                            Plain text version

To run the Ruby program:

1. Download and extract jruby:
Choose the latest jruby binary version
E.g. or jruby-bin-1.0.tar.gz

2. Optional: Add the jruby/bin directory to your path

3. Edit mq_test.rb to use your local Queue Manager.

4. Copy to the JRuby lib directory (or update the CLASSPATH before running JRuby)

5. jruby  mq_test.rb


Integrated Development Environment (IDE)

Not only did Sun hire the JRuby developers, they also put in a tremendous amount of work in making NetBeans 6 Ruby friendly. NetBeans 6 already comes with everything you need to create your own Ruby and Ruby on Rails applications.

The Full release includes JRuby and Ruby on Rails.

NetBeans 6 reads the Rakefile and makes all the targets directly available in the IDE. It also has direct support for the regular tasks for creating controllers etc.

Making the eclipse IDE work with JRuby is a lot more challenging. Over time the eclipse IDE should be able to catch up with the Ruby and JRuby features already in NetBeans. However, it is not likely that eclipse will achieve the ease of use found in NetBeans.

For long running server side Ruby programs run JRuby as follows:

jruby -O -J-server mq_test.rb

For more information on JRuby