Skip to content
remeniuk edited this page Oct 28, 2010 · 15 revisions

Asynchronous nature of node.js and it’s capabilities in handling huge number of connections (with a great potential for building COMET web-apps that doesn’t suck) is extremely appealing. However, being a standalone solution (web-server, TCP-server etc), connecting node.js to another ecosystems is not that straightforward (though there’re known options of extending node.js functionalities via C++ addons).

The most popular approach of bridging node.js to JVM (Ruby, etc) is setting up a message-bus (e.g. lightweight Redis Pub/Sub) between system components. The benefit of this approach is that you can have durable subscription and guaranteed delivery almost for free (the messages sent from node.js to JVM and vise versa aren't lost even if the system crashes). On the other hand, without a careful configuration and in-life monitoring, messaging bus can turn into a bottleneck and additional source of the headaches.

nodejs-scala-connector is an alternative approach for linking node.js to Scala (JVM) - no mediators are involved and system components communicate to each other directly.

Scala Remote Actors are accessible via TCP - multiple Actors can be registered on one node. Actors protocol is fairly simple, and the biggest problem is that remote actors marshal messages with Java Serialization facility (in order to achieve the best performance), and therefore non-Java applications can’t access remote actors directly. Protocol-buffers is an extensible alternative to native serialization that can be understood by a variety of languages: protobuf drivers exist for Java, node.js, Python, C++ etc.In Google protobuf is used for linking C++ applications to other ecosystems on a low-level. nodejs-scala-connector modifies standard remote actor in order to serialize messages into protobuf. On the node.js side, net.Stream will be used to asynchronously communicate with actors via TCP.

Clone this wiki locally