/** * @param mixed $annotatedEventListener * @param EventBusInterface $eventBus * @param AnnotationReaderFactoryInterface $annotationReaderFactory */ public function __construct($annotatedEventListener, EventBusInterface $eventBus, AnnotationReaderFactoryInterface $annotationReaderFactory) { $this->eventBus = $eventBus; $this->annotatedEventListener = $annotatedEventListener; $this->annotationReaderFactory = $annotationReaderFactory; if ($annotatedEventListener instanceof ReplayAwareInterface) { $this->replayAware = $annotatedEventListener; } $this->eventBus->getEventListenerRegistry()->subscribe($this); }
/** * Returns the EventListenerRegistryInterface of this EventBus. * * @return EventListenerRegistryInterface */ public function getEventListenerRegistry() { return $this->delegate->getEventListenerRegistry(); }
/** * @param DomainEventMessageInterface $domainEvent */ public function doWithEvent(DomainEventMessageInterface $domainEvent) { $this->logger->debug(sprintf("Visiting event %s with payload %s", $domainEvent->getIdentifier(), $domainEvent->getPayloadType())); $this->delegate->publish(array($domainEvent)); }
/** * @param TriggerExistingSagaEvent $event * @Governor\SagaEventHandler(associationProperty="identifier") */ public function onTriggerEvent(TriggerExistingSagaEvent $event) { $this->handledEvents[] = $event; $this->eventBus->publish(array(new GenericEventMessage(new SagaWasTriggeredEvent($this)))); }
/** * Starts recording event published by the event bus. */ public function startRecording() { $this->eventBus->getEventListenerRegistry()->subscribe($this); }