Exemplo n.º 1
0
 /**
  * @param Command $command
  * @param \Exception $exception
  * @return void
  */
 public function onDispatchFailed(Command $command, \Exception $exception)
 {
     $message = 'Dispatch failed!';
     if ($exception instanceof NoCommandHandlerException) {
         $message = 'Dead letter message encountered!';
     }
     $this->logger->error($message, ['type' => get_class($command), 'command' => $this->converter->objectToArray($command), 'exception' => $exception->getMessage()]);
 }
Exemplo n.º 2
0
 /**
  * @param array $criteria
  * @param int $offset
  * @param int $limit
  * @return Document[]
  */
 public function findBy(array $criteria, int $offset = 0, int $limit = 500) : array
 {
     $cursor = $this->collection->find($criteria, ['skip' => $offset, 'limit' => $limit]);
     return array_map(function (BSONDocument $document) : Document {
         $data = $document->getArrayCopy();
         unset($data['_id']);
         return $this->converter->arrayToObject($data, $this->documentClass);
     }, $cursor->toArray());
 }
Exemplo n.º 3
0
 /**
  * @param Event $event
  */
 public function onDispatchFailed(Event $event)
 {
     $this->logger->warning('Dead letter event encountered', ['type' => get_class($event), 'event' => $this->converter->objectToArray($event)]);
 }