Esempio n. 1
0
 public final function onEvent($redis, $chan, $msg)
 {
     $event = EventJsonSerializable::fromJson($msg);
     if (false === $event->isNamed($this->listenedEvent)) {
         return;
     }
     $this->execute($event);
 }
Esempio n. 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']);
 }
Esempio n. 3
0
 /**
  * {@inheritdoc}
  */
 public function publish(DomainEvent $event)
 {
     $this->redis->publish((string) $this->channel, json_encode(EventJsonSerializable::fromDomainEvent($event)));
 }