use RecoveryActionException to request Mesenger consumer restart

This commit is contained in:
macintoshplus
2024-11-29 18:02:37 +01:00
parent 9062ff5702
commit f0f241edc6
2 changed files with 6 additions and 0 deletions

View File

@@ -48,6 +48,9 @@
"doctrine/orm": "^2.19",
"phpunit/phpunit": "^9.6"
},
"conflict": {
"win32service/service-library": "<1.0.2"
},
"suggest": {
"ext-win32service": "On Windows only, install this extension to run PHP Service on Windows Service Manager"
},

View File

@@ -20,6 +20,7 @@ use Symfony\Component\Messenger\Stamp\FlushBatchHandlersStamp;
use Symfony\Component\Messenger\Stamp\NoAutoAckStamp;
use Symfony\Component\Messenger\Stamp\ReceivedStamp;
use Symfony\Component\Messenger\Transport\Receiver\ReceiverInterface;
use Win32Service\Exception\RecoveryActionException;
use Win32Service\Model\AbstractServiceRunner;
use Win32ServiceBundle\Event\MessengerWorkerMessageFailedEvent;
use Win32ServiceBundle\Event\MessengerWorkerMessageHandledEvent;
@@ -106,6 +107,8 @@ final class MessengerServiceRunner extends AbstractServiceRunner
$this->shouldStop = true;
$this->requestStop();
throw new RecoveryActionException('Restart requested');
}
protected function beforeContinue(): void