on exceptions, stomp logs the error and reenqueues

This commit is contained in:
Evan Prodromou 2010-01-30 13:15:17 -05:00
parent def5d56ce1
commit 4ae31f3476
1 changed files with 14 additions and 7 deletions

View File

@ -31,7 +31,6 @@
require_once 'Stomp.php'; require_once 'Stomp.php';
require_once 'Stomp/Exception.php'; require_once 'Stomp/Exception.php';
class StompQueueManager extends QueueManager class StompQueueManager extends QueueManager
{ {
protected $servers; protected $servers;
@ -587,7 +586,15 @@ class StompQueueManager extends QueueManager
return false; return false;
} }
// If there's an exception when handling,
// log the error and let it get requeued.
try {
$ok = $handler->handle($item); $ok = $handler->handle($item);
} catch (Exception $e) {
$this->_log(LOG_ERR, "Exception on queue $queue: " . $e->getMessage());
$ok = false;
}
if (!$ok) { if (!$ok) {
$this->_log(LOG_WARNING, "Failed handling $info"); $this->_log(LOG_WARNING, "Failed handling $info");