Database as an IPC Antiprocessor

I wrote a multi-level web application consisting of a rich web client (PHP) that interacts with a java service. The web client is hosted on the apache server, and the java service runs on the same physical machine (to repeat: the entire application, client, and service are running on the same physical machine).

User query -> DB <- Poller -> RequestHandler -> StoreResult on the DB page -> Web Client with Result (AJAX).

The relationship between the client and the service uses a relational database to send messages. The java service has a single-threaded interrogator that searches and then processes any messages / requests from the client. The system works, but I'm not sure about my design choice.

Does anyone have any comments about this strategy? I read that using the database as an IPC antipater is bad practice, or at least inappropriate. However, alternatives - XMLRPC, named pipes - seem to be associated with additional dependencies.

Thanks for watching.

+3
source share
4 answers

If it were me, and I need PHP to capture / use data from a java service, I would reset the DB.

Ask the java w / HTTP service to listen on 127.0.0.1, port 5544 (or some random #). Ask the servlet / jsp to accept RESTful requests and spit out the JSON results. Therefore, if you search for it, the URL will look like this:

h ttp://127.0.0.1: 5544/search_zip_code/80203

json:

{ "": "", "": "" }

PHP curl - URL- , curl, json_decode ($ result_array = json_decode ($ curl_result);).

. , ( curl/wget java- access_logs , ).

PHP curl_exec json_decode ( PHP).

, java:

JSON java-

( ), ( ) .

+4

DB IPC:

1) ( ) , - .

2) - .

3) . , , . , DB .

- ? . , . , -.

.

+1

, , , . - , DB PHP.

0

PHP, ActiveMQ - , UNIX IPC. , UNIX IPC. , ActiveMQ , , UNIX IPC, , .

0

Source: https://habr.com/ru/post/1767039/


All Articles