/** {@inheritDoc} */ public function handleMessage(Message $message, MessageDispatcher $messageDispatcher) { if ($message instanceof ErrorMessage) { $messageDispatcher->dispatch(new LogMessage([$message->getErrorMessage()], Logger::SEVERITY_ERROR)); } }
/** {@inheritDoc} */ public function handleMessage(Message $message, MessageDispatcher $messageDispatcher) { if ($message instanceof LogMessage) { $this->logger->log($message->getMessages(), $message->getSeverity()); } }
/** * Handle the message to delete the cached content hold by the identifier * through the injected cache proxy. * @param \Brickoo\Component\Messaging\Message $message * @return void */ public function handleDeleteMessage(Message $message) { if ($message instanceof DeleteMessage) { $this->storageProxy->delete($message->getIdentifier()); } }
/** {@inheritDoc} */ public function handleMessage(Message $message, MessageDispatcher $messageDispatcher) { if ($message instanceof ExceptionMessage) { $messageDispatcher->dispatch(new LogMessage($this->getExceptionMessage($message->getException()), Logger::SEVERITY_CRITICAL)); } }
/** * Dispatch the message to all corresponding listeners. * @param \Brickoo\Component\Messaging\Message $message * @throws \Brickoo\Component\Messaging\Exception\MaxRecursionDepthReachedException * @return \Brickoo\Component\Messaging\MessageDispatcher */ public function dispatch(Message $message) { $messageName = $message->getName(); if (!$this->listenerCollection->hasListeners($messageName)) { return $this; } if ($this->messageRecursionDepthList->isDepthLimitReached($messageName)) { throw new MaxRecursionDepthReachedException($messageName, $this->messageRecursionDepthList->getRecursionDepth($messageName)); } $this->messageRecursionDepthList->increaseDepth($messageName); $this->processMessage($message, $this->listenerCollection->getListeners($messageName)); $this->messageRecursionDepthList->decreaseDepth($messageName); return $this; }