/* php.ini
[stomp]
stomp.default_connection_timeout_sec = 10
stomp.default_read_timeout_sec = 15
these values should not be left by default.
if queue server very busy and there is a lot message in queue ,
not respond to frame in two second.
*/
try {
$stomp = new Stomp(self::geturl, self::username, self::password,array('client-id'=> gethostname()."-".uniqid(mt_rand(), true)));
$stomp->subscribe(self::getqueue, array('selector' => sprintf(self::selector, $queue_id)));
/* read a frame */
$frame = $stomp->readFrame();
if ($frame) {
$stomp->ack($frame);
unset($stomp);
return $frame;
}
unset($stomp);
return false;
} catch (StompException $e) {
print ('Connection failed: ' . $e->getMessage());
unset($stomp);
return false;
}
/* close connection */
unset($stomp);