コード例 #1
0
 /** {@inheritDoc} */
 public function handleMessage(Message $message, MessageDispatcher $messageDispatcher)
 {
     if ($message instanceof ErrorMessage) {
         $messageDispatcher->dispatch(new LogMessage([$message->getErrorMessage()], Logger::SEVERITY_ERROR));
     }
 }
コード例 #2
0
 /** {@inheritDoc} */
 public function handleMessage(Message $message, MessageDispatcher $messageDispatcher)
 {
     if ($message instanceof LogMessage) {
         $this->logger->log($message->getMessages(), $message->getSeverity());
     }
 }
コード例 #3
0
 /**
  * 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());
     }
 }
コード例 #4
0
 /** {@inheritDoc} */
 public function handleMessage(Message $message, MessageDispatcher $messageDispatcher)
 {
     if ($message instanceof ExceptionMessage) {
         $messageDispatcher->dispatch(new LogMessage($this->getExceptionMessage($message->getException()), Logger::SEVERITY_CRITICAL));
     }
 }
コード例 #5
0
 /**
  * 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;
 }