[rabbitmq-discuss] PHP AMQP client?

Tom Samplonius tom at samplonius.org
Sat Sep 29 02:10:31 BST 2007


----- "Alexis Richardson" <alexis.richardson at cohesiveft.com> wrote:
> On 9/28/07, Tom Samplonius <tom at samplonius.org> wrote:
> > > Does that make any sense?
> >
> >   While linking a C library to PHP would do the trick, introducing a
> new module API into PHP is definitely non-trivial.
> >
> >   I was hoping that there might be a native PHP library.  Isn't the
> Ruby library pure Ruby?  AMQP is a binary protocol, so a native PHP is
> a bit hard, but appears doable.
> 
> OK.  You are right about the Ruby client.  I'm afraid there is no
> native PHP client.  What are your thoughts on the pros and cons of
> doing one?  How useful would it be to you?

  Well, what is challenging about the PHP environment, is any long running tasks.  That is anything that can't be done during the http request/response cycle.  You will want to have a background worker handle any processing that takes 10+ seconds.  So the web handler can just put a message in the queue, and a background worker can process it.

  Also, doing critical steps in a web response code isn't exactly great either, because the Stop button issues.  In some cases, a stop, will cause the web server to stop the PHP interpreter, possible leaving various things in a unknown state.  Particularly if your PHP script is talking to an external web service.  It would be much better to have any critical processing done by a background worker, which has a more stable execution environment.

  An another issue, is serialization.  I have a remote control hardware device connected to a serial port.  Only one application can be talking to it at once.  A message queue provides an ideal serialization mechanism.

> alexis
> 
> 
> 
> -- 
> Alexis Richardson
> +44 20 7617 7339 (UK)
> +44 77 9865 2911 (cell)
> +1 650 206 2517 (US)


Tom




More information about the rabbitmq-discuss mailing list