Explorar el Código

fix(Consumer Sync Process): catch the exception

roiwk hace 1 año
padre
commit
50aae94ba7
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. 2 2
      src/Client.php

+ 2 - 2
src/Client.php

@@ -158,7 +158,7 @@ class Client
             $channel = $client->channel();
             $this->syncDeclare($channel);
             $channel->consume(
-                function (Message $message, Channel $channel, \Bunny\Client $client) use ($consumer) {
+                function (Message $message, Channel $channel, \Bunny\Client $client) use ($consumer, $reject) {
                     $this->logger?->info('Received:['.getmypid().']: '.$message->content, [$message]);
                     try {
                         call_user_func_array($consumer, [$message, $channel, $client]);
@@ -166,7 +166,7 @@ class Client
                         if (!$this->consume['noAck']) {
                             $channel->nack($message);
                         }
-                        throw $throw;
+                        $reject($throw);
                     }
                 },
                 $this->queue,