Try not abort on exception when we cannot dispatch a message to be processed
This commit is contained in:
parent
cabf9bca8b
commit
8c127ba5da
@ -139,20 +139,27 @@ final class Receive extends Item
|
|||||||
$queue = ($po->count() > config('app.queue_msgs'));
|
$queue = ($po->count() > config('app.queue_msgs'));
|
||||||
Log::info(sprintf('%s: - Messages will be sent to the queue for processing',self::LOGKEY));
|
Log::info(sprintf('%s: - Messages will be sent to the queue for processing',self::LOGKEY));
|
||||||
|
|
||||||
|
$error = FALSE;
|
||||||
foreach ($po as $msg) {
|
foreach ($po as $msg) {
|
||||||
Log::info(sprintf('%s: - Mail from [%s] to [%s]',self::LOGKEY,$msg->fftn,$msg->tftn));
|
Log::info(sprintf('%s: - Mail from [%s] to [%s]',self::LOGKEY,$msg->fftn,$msg->tftn));
|
||||||
|
|
||||||
// @todo Quick check that the packet should be processed by us.
|
// @todo Quick check that the packet should be processed by us.
|
||||||
// @todo validate that the packet's zone is in the domain.
|
// @todo validate that the packet's zone is in the domain.
|
||||||
|
|
||||||
// Dispatch job.
|
try {
|
||||||
if ($queue)
|
// Dispatch job.
|
||||||
MessageProcess::dispatch($msg);
|
if ($queue)
|
||||||
else
|
MessageProcess::dispatch($msg);
|
||||||
MessageProcess::dispatchSync($msg);
|
else
|
||||||
|
MessageProcess::dispatchSync($msg);
|
||||||
|
|
||||||
|
} catch (Exception $e) {
|
||||||
|
Log::error(sprintf('%s:! Got error dispatching message [%s] (%d:%s-%s).',self::LOGKEY,$msg->msgid,$e->getLine(),$e->getFile(),$e->getMessage()));
|
||||||
|
$error = TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($po->errors->count()) {
|
if ($po->errors->count() || $error) {
|
||||||
Log::info(sprintf('%s: - Not deleting packet [%s], as it has validation errors',self::LOGKEY,$this->file));
|
Log::info(sprintf('%s: - Not deleting packet [%s], as it has validation errors',self::LOGKEY,$this->file));
|
||||||
|
|
||||||
// If we want to keep the packet, we could do that logic here
|
// If we want to keep the packet, we could do that logic here
|
||||||
|
Loading…
Reference in New Issue
Block a user