Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connect PHP code to Java backend

I am implementing a website using PHP for the front end and a Java service as the back end. The two parts are as follows:

  1. PHP front end listens to http requests and interacts with the database.

  2. The Java back end run continuously and responds to calls from the front end.

More specifically, the back end is a daemon that connects and maintain the link to several IM services (AOL, MSN, Yahoo, Jabber...).

Both of the layers will be deployed on the same system (a CentOS box, I suppose) and introducing a middle layer (for instance: using XML-RPC) will reduce the performance (the resource is also rather limited).

Question: Is there a way to link the two layers directly? (no more web services in between)

like image 459
ThoaiOnline Avatar asked May 21 '09 08:05

ThoaiOnline


1 Answers

Since this is communication between two separate running processes, a "direct" call (as in JNI) is not possible. The easiest ways to do such interprocess communcation are probably named pipes and network sockets. In both cases, you'll have to define a communication protocol and implement it on both sides. Using a standard protocol such as XML-RPC makes this easier, but is not strictly necessary.

like image 185
Michael Borgwardt Avatar answered Oct 11 '22 00:10

Michael Borgwardt