Beispiel #1
0
 /**
  * Save a Chapter event to the chapter history.
  *
  * @param Message $domainMessage
  * @throws \Prooph\Done\Shared\Exception\StoryName
  * @throws \Exception
  */
 public function logChapterEvent(Message $domainMessage)
 {
     $storyName = Metadata::getStoryNameFromMessage($domainMessage);
     if (!isset($this->storyTellers[$storyName->toString()])) {
         throw Exception\StoryName::isNotLinkedWithStoryTeller($storyName);
     }
     $storyTeller = $this->storyTellers[$storyName->toString()];
     try {
         $this->eventStore->beginTransaction();
         $storyTeller($domainMessage);
         $this->eventStore->commit();
     } catch (\Exception $ex) {
         $this->eventStore->rollback();
         throw $ex;
     }
 }