views:

99

answers:

2

What is the best way of integrating node.js with Scala (Java)?

The simplest way I see so far is using Redis PubSub as a mediator, with node.js server handling HTTP requests and publishing messages to the request channel (via redis-node-client), and Scala actors (e.g. Akka Redis PubSub integration) subscribed the request channel and publishing computation results to the response channel (subscribed by nodes).

+3  A: 

Assuming you'll be using JSON as your message format, you'll find a couple of very good JSON implementations inside the lift framework (which you don't have to use as a web framework, you can happily cherry-pick components from lift-utils).

But if you want to go with a pubsub/actor model (and it's a good choice, depending on your needs) then you could do a lot worse than Akka, as you already suggested.

Kevin Wright
AFAIU, you're suggesting to use [RPC-style] JSON-dispatcher (like this http://demo.liftweb.net/stateless_json) sending JSON to Lift from node.js over HTTP, right?
Vasil Remeniuk
+2  A: 

I've implemented a small proof-of-concept library for connecting node.js to Scala Remote Actors directly via TCP (using protobuf as a marshalling mechanism).

Vasil Remeniuk