Java/Ruby communication

N

Nigel Gilbert

I am planning to write a Java program and and a Ruby program and have
them intercommunicate, with a bidirectional flow of fairly small
amounts of data from one to to the other and back. I know that I could
achieve this by running the ruby program in JRuby, but it would not run
fast enough (a crude benchmark implies that JRuby executes Ruby about
an order of magnitude slower than I would get using Ruby itself).

The communication could, I suppose, be done with pipes or TCP or even
by reading and writing files. Does anyone have experience of doing
this, and tips or code snippets they could share?

Nigel
 
M

Mauricio Fernández

I am planning to write a Java program and and a Ruby program and have
them intercommunicate, with a bidirectional flow of fairly small
amounts of data from one to to the other and back. I know that I could
achieve this by running the ruby program in JRuby, but it would not run
fast enough (a crude benchmark implies that JRuby executes Ruby about
an order of magnitude slower than I would get using Ruby itself).

The communication could, I suppose, be done with pipes or TCP or even
by reading and writing files. Does anyone have experience of doing
this, and tips or code snippets they could share?

[shameless plug]

if you can afford to wait for some time you could use rjni, which
provides transparent, seamless Java/Ruby interaction via JNI. It allows
you to instantiate Java classes from Ruby, call Java methods, implement
Java interfaces with Ruby objects, etc...

I am currently re-implementing several parts of rjni in C for
performance reasons. I cannot give any guarantee whatsoever on the
release date (the fact that I've had no connectivity for nearly 3 weeks
hasn't helped either).

--
_ _
| |__ __ _| |_ ___ _ __ ___ __ _ _ __
| '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \
| |_) | (_| | |_\__ \ | | | | | (_| | | | |
|_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_|
Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com

Windows without the X is like making love without a partner.
-- MaDsen Wikholm, (e-mail address removed)
 
K

Kent Dahl

Nigel said:
I am planning to write a Java program and and a Ruby program and have
them intercommunicate, with a bidirectional flow of fairly small amounts
of data from one to to the other and back. I know that I could achieve
this by running the ruby program in JRuby, but it would not run fast
enough (a crude benchmark implies that JRuby executes Ruby about an
order of magnitude slower than I would get using Ruby itself).

The communication could, I suppose, be done with pipes or TCP or even by
reading and writing files. Does anyone have experience of doing this,
and tips or code snippets they could share?

XML-RPC was fairly easy to set up on both the Java and Ruby end when I
tried it a year ago. Check out xmlrpc4r on RAA.
 
S

Shashank Date

^^^^^
We don't know if 'data' is binary or text only.
XML-RPC was fairly easy to set up on both the Java and Ruby end when I

Pardon my ignorance in this area ... but does XML-RPC allow for exchange of
binary data also ?

-- shanko
 
J

james_b

Shashank said:
Pardon my ignorance in this area ... but does XML-RPC allow for exchange of
binary data also ?

Yes, sort of. All data must be XML-compliant, so arbitray binary stuff
(such as a jpeg image) must be base-64 (or the like) encoded to ensure
the data payload doesn't contain troublesome character sequences.


James
 
A

Aredridel

--=-6HNu5k7/RdYS9XvKp3iy
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
Pardon my ignorance in this area ... but does XML-RPC allow for exchange = of
binary data also ?

send(data.base64)

data =3D recv.unbase64

Ari

--=-6HNu5k7/RdYS9XvKp3iy
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQA/OoSRtP09exA3hooRApa4AJ9JtZridAhzoXvI9Afov21BGSje0ACgwV3b
4G7XapOZ7DYwxZZD4XB1X+w=
=Keqd
-----END PGP SIGNATURE-----

--=-6HNu5k7/RdYS9XvKp3iy--
 
J

james_b

Kent said:
XML-RPC was fairly easy to set up on both the Java and Ruby end when I
tried it a year ago. Check out xmlrpc4r on RAA.

I believe this is noe part of the standard ditribution, no?

Anyways, I just added XML-RPC methods to some blogging software, and it
really is quite simple.

James Britt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top