Thursday, April 12, 2012

How Java and NodeJS communicate in backend?

I have already done a project using jsp as backend, while the business logic in backend is implemented by java. Now I want to rewrite this project.I hope the part of backend communicating with browser is implemented with nodejs and the business logic in backend still use java to implement.Now I met with a problem about how to communicate between nodejs and java in backend. Is there any feasible solution? Thanks

1 comment:

  1. Node.js is a standalone runtime environment (based on V8, which is implemented in C++). Since it is not based on Java technology it has no "simple" way to communicate with Java code running in a JVM.

    Integrating unrelated technologies, such as these two, is typically done by using some sort of inter-process communication, for example, TCP sockets or a message queue with bindings native to each platform (e.g. zeromq). Creating a JNI interface is another possible option.

    Searching the web for keywords such as "node.js java bridge" yields a number of interesting results.