src/Dispatcher.php
private function handleMessage(HandlerInterface $handler, MessageInterface $message): bool
    {
        // check if handler implements Psr\Log\LoggerAwareInterface (you can use \Psr\Log\LoggerAwareTrait)
        if ($this->logger && method_exists($handler, 'setLogger')) {
            $handler->setLogger($this->logger);
        }

        try {
            $result = $handler->handle($message);

            $this->log(
                LogLevel::INFO,
                "End handle message #{$message->getId()} ({$message->getType()})",
                $this->messageLoggerContext($message)
            );
        } catch (Exception $e) {
            $this->log(
                LogLevel::ERROR,
                "Handler " . get_class($handler) . " throws exception - {$e->getMessage()}",
                ['error' => $e, 'message' => $this->messageLoggerContext($message), 'exception' => $e]
            );
            Debugger::log($e, Debugger::EXCEPTION);
            $result = false;
        }
        return $result;
    }
private function handleMessage(HandlerInterface $handler, MessageInterface $message): bool
    {
        // check if handler implements Psr\Log\LoggerAwareInterface (you can use \Psr\Log\LoggerAwareTrait)
        if ($this->logger && method_exists($handler, 'setLogger')) {
            $handler->setLogger($this->logger);
        }

        try {
            $result = $handler->handle($message);

            $this->log(
                LogLevel::INFO,
                "End handle message #{$message->getId()} ({$message->getType()})",
                $this->messageLoggerContext($message)
            );
        } catch (Exception $e) {
            $this->log(
                LogLevel::ERROR,
                "Handler " . get_class($handler) . " throws exception - {$e->getMessage()}",
                ['error' => $e, 'message' => $this->messageLoggerContext($message), 'exception' => $e]
            );
            Debugger::log($e, Debugger::EXCEPTION);
            $result = false;
        }
        return $result;
    }
private function handleMessage ( HandlerInterface $ handler , MessageInterface $ message ) : bool { // check if handler implements Psr\Log\LoggerAwareInterface (you can use \Psr\Log\LoggerAwareTrait) if ( $ this -> logger && method_exists ( $ handler , 'setLogger' ) ) { $ handler -> setLogger ( $ this -> logger ) ; } try { $ result = $ handler -> handle ( $ message ) ; $ this -> log ( LogLevel :: INFO , "End handle message #{$message->getId()} ({$message->getType()})" , $ this -> messageLoggerContext ( $ message ) ) ; } catch ( Exception $ e ) { $ this -> log ( LogLevel :: ERROR , "Handler " . get_class ( $ handler ) . " throws exception - {$e->getMessage()}" , [ 'error' => $ e , 'message' => $ this -> messageLoggerContext ( $ message ) , 'exception' => $ e ] ) ; Debugger :: log ( $ e , Debugger :: EXCEPTION ) ; $ result = false ; } return $ result ; }
Handle given message with given handler

@param HandlerInterface $handler
@param MessageInterface $message

@return bool
Handle given message with given handler