I want to set up asynchronous messaging with our application and I’m
thinking it would be good to leverage the existing JMS in our app
server.
There are some examples on the web on how to write JMS code in Ruby but
it is unclear how to set up an MDB as a way to pull messages off a queue
and do the async processing.
It looks like I can write the MDB code in Ruby but then what? How do I
deploy this code to the app server? Warbler is handling all the
deployment stuff for my Rails app but not for MDBs. I want to make sure
the MDB is running within the same JVM and has access to parts of my
application.
Yes, I’ve looked at ActiveMessaging however this solution requires you
to create a poller. In Windows, I’d have to think about making the
poller program a Windows service and it would launch another JVM.
Using an MDB seemed simpler since I already have a very robust app
server running.
I know you mentioned using Warbler earlier in this thread but I
just wanted to point out that TorqueBox 1 has something called
Message Processors which sounds like the Ruby MDBs you want.
Check out 2 for full documentation but essentially you have a
Ruby class with an on_message method that gets wired up to a
queue / topic via config/torquebox.yml:
class MyFooHandler < TorqueBox::Messaging::MessageProcessor
def on_message(body)
puts “Received #{body} of #{message}”
end
end
config/torquebox.yml:
messaging:
/queues/foo: MyFooHandler
If you’re not able to try out TorqueBox it may still be worth
digging around in our source some to see how the Ruby class gets
wired up to the JMS destination 3.
Ben
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.