How to connect Jms from PHP ?

后端 未结 2 1021
迷失自我
迷失自我 2021-01-01 02:51

I am trying to implement my sites little chat function like facebook uses. I used Html, PHP, JQuery and Apache. I made before some exaples with JMS but I couldn\'t figure ou

相关标签:
2条回答
  • 2021-01-01 02:59

    Just to give two other options: OpenMQ (using HTTP) and PHPMQ

    (My two cents about the accepted answer) Great answer, one quibble: Gearman is great for Remote Procedure Calls, but as to message passing, JMS is much more robust (persistence, etc.). Aim for JMS in some way would be my suggestion.

    0 讨论(0)
  • 2021-01-01 03:20

    You have a few options. Let's go through them in order of worst to not-worst.

    First is Quercus, a PHP implementation in Java. PHP code running in Quercus can instantiate Java classes and call methods on them, just like they were PHP objects. You'd be able to work with JMS in the same way you'd work with it in Java. I have no experience with this one.

    Second is the PHP/Java Bridge. It's a bit more complex to get working, but it effectively works the same way as Quercus, code-wise. You'd be able to work directly with any old Java API. I have experience with this one, and it wasn't pleasant. Java processes ended up hanging around in a zombie state after the corresponding Apache+PHP child exited. We eventually had to write a cron script to clean up all working Java processes nightly, otherwise the server would eventually run out of available memory.

    Third would be looking at different JMS providers, like ActiveMQ. Why? Because ActiveMQ supports many messaging APIs, including Stomp, a language-agnostic messaging API that happens to have a PHP extension. It's possible that Weblogic can speak Stomp, but I was unable to determine if this is the case. The only Google results were for Weblogic + ActiveMQ integration.

    Fourth would be not thinking about JMS. JMS is a Java solution. PHP ain't Java. There are plenty of message queue systems out there that work well with PHP. ActiveMQ is only one example. I personally prefer Gearman. Gearman was originally designed to perform sharded remote procedure calls, but it works equally as well for simple message passing, and has a PHP extension as well as bindings for most other languages under the sun.

    0 讨论(0)
提交回复
热议问题