Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Ruby (or JRuby) and JMS

 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm currently working on an "enterprise" system which makes a lot of use of JMS messaging. Testing this is system is turning out to be an irritating job using Java, as we have to compile locally then laboriously and manually sftp class files to the production server in order to run them.

I'd love to have access to a decent scripting language to speed up this process, and Ruby is my current favourite.

So, has anyone else used Ruby or JRuby to connect, send and recieve JMS messages? Any suggestions of pre-written libraries or examples?

If such things exist for another scripting language I'd consider that too, provided it runs on Solaris and installs/runs from a regular user account.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suppose you could either:

1) use JRuby (require_class 'javax.jms.Foo'; Foo.new) and simply "port" your Java JMS client code to Ruby

2) use Ruby and a native client library for your specific JMS provider, if applicable

And if you happen to use ActiveMQ as your JMS provider, you could also use the STOMP protocol for which there is a native Ruby client available.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, and 3) use RJNI.
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. I'd seen the STOMP stuff, but as we are mainly contacting queues hosted on WebLogic servers, I guess that doesn't apply.

I'll have a go with the JRuby port approach and see how well it works.
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) use JRuby (require_class 'javax.jms.Foo'; Foo.new) and simply "port" your Java JMS client code to Ruby

How well does a jms message map to jruby messages? Do they intergrate fine?
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Pradip Bhat:
How well does a jms message map to jruby messages? Do they intergrate fine?

There is no mapping involved. With JRuby, you're running on a JVM and the message object you manipulate is essentially the same message object that you would manipulate with pure Java. There's just a bit of Reflection-based magic in between to delegate method calls inside the JRuby interpreter into method calls in the JVM.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic