[英]Sending messages from php to java
My app is a feed aggregator.我的应用程序是一个提要聚合器。 The frontend is programmed in php, but I have a Java program running periodically to update the feeds database.
前端在 php 中编程,但我有一个 Java 程序定期运行以更新提要数据库。 Under the current scheme if a user adds a feed to be aggregated he must have to wait until the aggregator runs and updates the database to see the news from the feed he subscribed.
在当前方案下,如果用户添加要聚合的提要,他必须等到聚合器运行并更新数据库才能看到来自他订阅的提要的新闻。 What I want to do is to securely send a message from the php script to the aggregator issuing an exceptional feed update.
我想要做的是从 php 脚本安全地向聚合器发送一条消息,该聚合器发布一个特殊的提要更新。
Open a server socket in Java application.在 Java 应用程序中打开一个服务器套接字。 Then send the data over it.
然后通过它发送数据。 You may use SSL to secure the communication.
您可以使用 SSL 来保护通信。
You can use some well-established language agnostic remote communications protocols like SOAP or REST (both supported by java and php) or develop you own socket based solution.您可以使用一些成熟的与语言无关的远程通信协议,例如 SOAP 或 REST(均受 java 和 php 支持)或开发自己的基于套接字的解决方案。
Additional option might be php-java bridge which promises to be performance wise effective.附加选项可能是php-java 桥接器,它有望在性能方面有效。
If the java program is on the PHP server can't you just simply open a shell from php to run the java program with arguments to trigger the update? If the java program is on the PHP server can't you just simply open a shell from php to run the java program with arguments to trigger the update?
Would having the java app waiting for commands on a socket be an acceptable option?让 java 应用程序等待套接字上的命令是一个可接受的选项吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.