/**
  * @param InitializeEventStore $command
  */
 public function handle(InitializeEventStore $command)
 {
     $esConfig = EventStoreConfig::initializeWithSqliteDb($command->sqliteDbFile(), $command->eventStoreConfigLocation(), $this->configWriter);
     foreach ($esConfig->popRecordedEvents() as $recordedEvent) {
         $this->eventBus->dispatch($recordedEvent);
     }
 }
 /**
  * Runs the initial set up of the processing system
  */
 public function runAction()
 {
     try {
         $this->commandBus->dispatch(CreateDefaultProcessingConfigFile::in(ConfigLocation::fromPath(Definition::getSystemConfigDir())));
         $sqliteDbFile = SqliteDbFile::initializeFromDist(Definition::getEventStoreSqliteDbFile());
         $esConfigLocation = ConfigLocation::fromPath(Definition::getSystemConfigDir());
         $this->commandBus->dispatch(InitializeEventStore::setUpWithSqliteDbAdapter($sqliteDbFile, $esConfigLocation));
     } catch (\Exception $ex) {
         $this->commandBus->dispatch(UndoSystemSetUp::removeConfigs(Definition::getSystemConfigDir(), Definition::getSystemConfigDir(), Definition::getEventStoreSqliteDbFile()));
         throw $ex;
     }
     return $this->redirect()->toRoute('prooph.link/system_config');
 }