コード例 #1
0
 /**
  * @param $job
  * @param $data
  * @return mixed
  */
 public function fire($job, $data)
 {
     $payload = json_decode($data['payload'], true);
     $event = call_user_func([str_replace('.', '\\', $data['type']), 'deserialize'], $payload['payload']);
     $this->eventDispatcher->dispatch($data['type'], [$event]);
     return $job->delete();
 }
 /**
  *
  */
 protected function replayEvents()
 {
     $allEvents = $this->getAllEvents();
     $this->output->progressStart(count($allEvents));
     foreach ($allEvents as $eventRow) {
         $object = ['class' => str_replace('.', '\\', $eventRow->type), 'payload' => json_decode($eventRow->payload, true)['payload']];
         try {
             $this->dispatcher->dispatch($eventRow->type, $this->serializer->deserialize($object));
         } catch (SerializedClassDoesNotExist $e) {
             if ($this->logger) {
                 $this->logger->debug("Event class does not exist: [{$object['class']}]");
             }
             continue;
         }
     }
     $this->output->progressFinish();
 }
コード例 #3
0
 /**
  * @param EventDispatcher $eventDispatcher
  * @param $eventRow
  */
 protected function dispatchEvent(EventDispatcher $eventDispatcher, DomainMessage $eventRow)
 {
     $eventDispatcher->dispatch($eventRow->getType(), [$eventRow->getPayload()], true);
 }