Пример #1
0
 /**
  * @return EventStore
  */
 protected function getOtherMachineEventStore()
 {
     if (is_null($this->otherMachineEventStore)) {
         $inMemoryAdapter = new InMemoryAdapter();
         $config = new Configuration();
         $config->setAdapter($inMemoryAdapter);
         $this->otherMachineEventStore = new EventStore($config);
         $this->otherMachineEventStore->getActionEventDispatcher()->attachListener("commit.post", function (PostCommitEvent $postCommitEvent) {
             $this->otherMachineLastPostCommitEvent = $postCommitEvent;
             foreach ($postCommitEvent->getRecordedEvents() as $event) {
                 $this->otherMachineEventNameLog[] = $event->messageName();
             }
         });
         $this->otherMachineEventStore->beginTransaction();
         $this->otherMachineEventStore->create(new Stream(new StreamName('prooph_processing_stream'), []));
         $this->otherMachineEventStore->commit();
     }
     return $this->otherMachineEventStore;
 }