/** * @inheritdoc */ public function getEventChannelFor($target, $origin = null, $sender = null) { if (is_null($target)) { $target = Definition::SERVICE_WORKFLOW_PROCESSOR; } if (!is_string($target) || empty($target)) { throw new \RuntimeException('Target must be a non empty string'); } $channelName = 'processing.event_bus.' . $target; if (isset($this->cachedChannels[$channelName])) { return $this->cachedChannels[$channelName]; } $eventBus = $this->services->get($channelName); if (!$eventBus instanceof EventBus) { throw new \RuntimeException(sprintf("EventBus for target %s must be of type Prooph\\ServiceBus\\EventBus but type of %s given!", $target, is_object($eventBus) ? get_class($eventBus) : gettype($eventBus))); } foreach ($this->cachedPlugins as $plugin) { $eventBus->utilize($plugin); } $this->cachedChannels[$channelName] = $eventBus; return $eventBus; }
/** * @return EventStore */ public function getEventStore() { return $this->services->get('prooph.event_store'); }