On Feb 18, 2011, at 6:44 AM, Jeff Rose wrote: > Hi, > I'm using a set of back-end services to drive a PHP application. > Currently I have to connect to ActiveMQ with a new Stomp instance for every > request, but I'd like to use a pool of persistent connections like MongoDB > or MySQL offers. Does anyone know of a Stomp implementation that has > persistent connections, or else does anyone know how to store "persistent" > objects across PHP request processes?
My direct answer is I'm not sure how you could keep those connections alive across requests. I think stomp as a protocol is pretty lightweight, though, and creating a new connection shouldn't add a lot of overhead to your script. "Some types of data can not be serialized thus stored in sessions. It includes resource variables or objects with circular references (i.e. objects which passes a reference to itself to another object)." http://www.php.net/manual/en/intro.session.php You can put just about anything you want into $_SESSION, but not resources like network connections or file handles. To get persistent stomp along the lines of persistent database connections, you'll probably need to write a C extension. But then you're looking at 1 stomp connection per Apache worker, and they'll be holding those connections even if they're not actually doing anything with them. alex