I was in a similar situation. Have a fairly large set of libraries in
Java that needed to be called from Ruby.

Started out building a Rails app in JRuby, but found enough grief
(RSpec unusably slow, various Gems not working correctly and failing
at the most inopportune times) that I decided another approach was
called for.

The idea was to completely split the Java codebase from the Rails
codebase and use HTTP to communicate between the two. This has worked
out very well. Here's the approach:

1) Expose Java functionality as Restlet: http://www.restlet.org/
2) Deploy Restlet using Jetty (lightweight container that uses about
as much memory as a Mongrel instance for what I'm doing, supports
multiple connections, and requires very little configuration).
3) Delegate all Java API calls to Restlet using HTTP. This always
happens in models, not controllers, to keep things manageable.
4) Stub out Restlet functionality in RSpec.

The outside world only sees the Rails app, so all session management,
authentication, authorization can be localized in one codebase.


On Aug 31, 7:08 am, Scott Olmsted <[email protected]> wrote:
> A software architect friend wrote me with a question I can't answer
> because I don't do Java. I though I would see if any one has any
> comments on his idea, or links to resources.
>
> Thanks,
>
> Scott
>
> He wrote:
>
> I'm thinking for the start-up that I will be working with of using an
> architecture with Rails as the web site, but the back end consisting
> of a cluster of various long-running services and integrations with
> other financial institutions, to use java.  It seems that all of the
> enterprise middleware is java-based, so if you want to do something
> in that area, you kinda have to use java or at least something that
> compiles down to java byte code.
>
> The motivation would be to try to take advantage of the productivity
> gains of RAILS at least for those portions of the site.
>
> The Ruby front end would function as a client of the business servers
> using REST or some other API; or it could use the java JMS API to
> access the queuing middleware, if we use jRuby.
>
> Do you have any thoughts on this architecture?  Warnings?  

--~--~---------~--~----~------------~-------~--~----~
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby
-~----------~----~----~----~------~----~------~--~---

Reply via email to