diff --git a/src/Consumer.php b/src/Consumer.php index 2d90a6d..2efbc11 100644 --- a/src/Consumer.php +++ b/src/Consumer.php @@ -139,10 +139,10 @@ public function listenToQueue($handlerClass, BowlerExceptionHandler $exceptionHa $channel->queue_bind($this->queueName, $this->exchangeName); } - // Instantiate Handler - $queueHandler = app($handlerClass); + $callback = function ($message) use ($handlerClass, $exceptionHandler) { + // Instantiate Handler + $queueHandler = app($handlerClass); - $callback = function ($message) use ($queueHandler, $exceptionHandler) { $broker = new MessageBroker($message); try {