/** * Publishes the events from the domain event stream to the listeners. * * @param DomainEventStreamInterface $domainMessages * @throws \Exception */ public function publish(DomainEventStreamInterface $domainMessages) { $this->transactionManager->beginTransaction(); try { $this->eventBus->publish($domainMessages); $this->transactionManager->commit(); } catch (\Exception $e) { $this->transactionManager->rollback(); throw $e; } }