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