File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -90,6 +90,15 @@ public function processMessage(AMQPMessage $msg)
9090 'return_code ' => $ processFlag
9191 )
9292 ));
93+ } catch (Exception \StopConsumerException $ e ) {
94+ $ this ->logger ->info ('Consumer requested restart ' , array (
95+ 'amqp ' => array (
96+ 'queue ' => $ this ->queueOptions ['name ' ],
97+ 'message ' => $ msg ,
98+ 'stacktrace ' => $ e ->getTraceAsString ()
99+ )
100+ ));
101+ $ this ->stopConsuming ();
93102 } catch (\Exception $ e ) {
94103 $ this ->logger ->error ($ e ->getMessage (), array (
95104 'amqp ' => array (
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace OldSound \RabbitMqBundle \RabbitMq \Exception ;
4+
5+ /**
6+ * If this exception is thrown in consumer service the message
7+ * will not be ack and consumer will stop
8+ * if using demonized, ex: supervisor, the consumer will actually restart
9+ * Class RestartConsumerException
10+ * @package OldSound\RabbitMqBundle\RabbitMq\Exception
11+ */
12+ class StopConsumerException extends \RuntimeException
13+ {
14+
15+ }
You can’t perform that action at this time.
0 commit comments