require_once 'Stomp.php';
require_once 'Stomp/Exception.php';
-
class StompQueueManager extends QueueManager
{
protected $servers;
protected $control;
protected $useTransactions = true;
-
+
protected $sites = array();
protected $subscriptions = array();
$this->_connect();
return $this->_doEnqueue($object, $queue, $this->defaultIdx);
}
-
+
/**
* Saves a notice object reference into the queue item table
* on the given connection.
}
return true;
}
-
+
/**
* Subscribe to all the queues we're going to need to handle...
*
if ($con) {
$this->cons[$idx] = $con;
$this->disconnect[$idx] = null;
-
+
// now we have to listen to everything...
// @fixme refactor this nicer. :P
$host = $con->getServer();
return false;
}
- $ok = $handler->handle($item);
+ // If there's an exception when handling,
+ // log the error and let it get requeued.
+
+ try {
+ $ok = $handler->handle($item);
+ } catch (Exception $e) {
+ $this->_log(LOG_ERR, "Exception on queue $queue: " . $e->getMessage());
+ $ok = false;
+ }
if (!$ok) {
$this->_log(LOG_WARNING, "Failed handling $info");
$this->begin($idx);
return $shutdown;
}
-
+
/**
* Set us up with queue subscriptions for a new site added at runtime,
* triggered by a broadcast to the 'statusnet-control' topic.