public final function onEvent($redis, $chan, $msg) { $event = EventJsonSerializable::fromJson($msg); if (false === $event->isNamed($this->listenedEvent)) { return; } $this->execute($event); }
public function execute(EventJsonSerializable $event) { echo sprintf('[Redis] booking#%s has been confirmed. We need to print a voucher.' . PHP_EOL, $event->getProperties()['bookingId']); }
/** * {@inheritdoc} */ public function publish(DomainEvent $event) { $this->redis->publish((string) $this->channel, json_encode(EventJsonSerializable::fromDomainEvent($event))); }