Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function process(CommandMessage $message, callable $next)
 {
     $command = ClassName::short($message->payloadType()->toString());
     try {
         $this->logger->debug(sprintf('Command (%s) received: %s', $command, date(DATE_ATOM)), ['message' => $message->toString()]);
         $next($message);
         $this->logger->debug(sprintf('Command (%s) handled: %s', $command, date(DATE_ATOM)), ['message' => $message->toString()]);
     } catch (Exception $exception) {
         $this->logger->error(sprintf('Command (%s) failed: %s', $command, date(DATE_ATOM)), ['message' => $message->toString(), 'exception' => $exception]);
         throw $exception;
     }
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function process(QueryMessage $message, callable $next)
 {
     $query = ClassName::short($message->payloadType()->toString());
     try {
         $this->logger->debug(sprintf('Query (%s) received: %s', $query, date(DATE_ATOM)), ['message' => $message->serialize()]);
         $data = $next($message);
         $this->logger->debug(sprintf('Query (%s) handled: %s', $query, date(DATE_ATOM)), ['message' => $message->serialize()]);
     } catch (Exception $exception) {
         $this->logger->error(sprintf('Query (%s) failed: %s', $query, date(DATE_ATOM)), ['message' => $message->serialize(), 'exception' => $exception]);
         throw $exception;
     }
     return $data;
 }