PHP-Java 互操作 - Gearman 还是 PJB?

发布于 2024-10-25 18:04:48 字数 378 浏览 1 评论 0原文

从 PHP 调用 Java 的总体最佳选择是什么?

还是其他什么东西?我所说的“最好”是指易于使用、可靠、透明(用于调试目的)——整个辣酱玉米饼馅。

换句话说,这两种解决方案都有什么重大缺点吗?

编辑:原因是 PHP 站点需要使用第 3 方 SOAP 服务。对于任何纯 PHP 客户端来说,WSDL 中定义的类型层次结构似乎都过于复杂。

Which is the overall best option for calling Java from PHP?

or something else entirely? By "best" I mean easy to use, reliable, transparent (for debugging purposes) - the whole enchilada.

To put it the other way, does either solution have any major shortcomings?

Edit: the reason for this is a PHP site which needs to use a 3rd party SOAP service. The type hierarchy defined in the WSDL appears to be too complex for any pure PHP client.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

空心↖ 2024-11-01 18:04:48

PHP/Java 桥是有效的,但我们发现它往往会留下僵尸 JVM 进程作为 Apache 子进程,必须通过 kill -9 才能摆脱它们。我们最终每天运行一个 cron 作业来解决这个问题。我们只将它用于一个特定的类(一个连接到某人的可怕 SOAP 端点的接口类),并且在类型处理方面有点挑剔,但它确实对我们有用。 (僵尸进程问题可能是由于我们当时使用的史前 PHP 版本造成的,所以现在可能已经修复了。)

我对 Gearman 和 Java 没有任何经验,但对 PHP 有很多经验。在大多数情况下,与我们合作是一件很愉快的事情。最烦人的问题是处理来自调用者的异步更新需要一些相当冗长的代码来处理所有可能的状态。然而,对于“即发即弃”和“即发即返回立即结果”RPC,它确实很难被击败。

The PHP/Java bridge is functional, but we found that it tended to leave around zombie JVM processes as Apache children that have to be kill -9'd to get rid of. We ended up running a cron job daily to take care of the problem. We only used it for one specific class (an interface class to someone's horrid SOAP endpoint), and it was a tad bit finicky when it came to type juggling, but it did work for us. (The zombie process problem may have been due to the prehistoric PHP version we were using at the time, so it may have been fixed by now.)

I don't have any experience with Gearman and Java, but plenty of it with PHP. It's been a pleasure to work with, for the most part. The most annoying issue is that processing async updates from the caller requires some pretty verbose code to handle all of the possible states. For fire-and-forget and fire-and-get-back-immediate-results RPC, though, it's really hard to beat.

深爱成瘾 2024-11-01 18:04:48

Gearman 可能并不是您真正想要的解决方案(除非您确实想要一个作业队列而不是某种形式的 RPC)。它可以以阻塞/同步的方式运行,但它给聚会带来了大量的开销(代码/应用程序/等方面),我猜这是一个简单的任务?

在不知道你想做什么的情况下,我会提出一些建议。 XML-RPC(可能比 SOAP 稍微不那么邪恶!)或者可能是 Facebook 的 Thrift[1]、Apache Avro[2] 或 Google Protocol Buffers[3] 之类的东西?

[1] http://incubator.apache.org/thrift/

[2] http://avro.apache.org/

[3] http://code.google.com/apis/protocolbuffers/

Gearman is probably not really the solution you are after (unless you really want a job queue rather than some form of RPC). It can operate in a blocking/synchronous fashion but it brings alot of overhead (code/application/etc wise) to the party for what i'm guessing is a simple task?

Without knowing what you are trying to do i'm going to throw some suggestion out there. XML-RPC (can be slightly less evil than SOAP!) or maybe something like Facebook's Thrift[1], Apache Avro[2], or Google Protocol Buffers[3]?

[1] http://incubator.apache.org/thrift/

[2] http://avro.apache.org/

[3] http://code.google.com/apis/protocolbuffers/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文