Exemplo n.º 1
0
 /**
  * {@inheritDoc}
  */
 public function execute($command)
 {
     $this->queue->enqueue($command);
     if (!$this->isDispatching) {
         $this->isDispatching = true;
         try {
             while (!$this->queue->isEmpty()) {
                 $this->processCommand($this->queue->pop());
             }
         } finally {
             $this->isDispatching = false;
         }
     }
 }
Exemplo n.º 2
0
 /**
  * {@inheritDoc}
  */
 public function publish(DomainEventInterface $event)
 {
     $this->queue->enqueue($event);
     if (!$this->isPublishing && !$this->queue->isEmpty()) {
         $this->isPublishing = true;
         try {
             while (!$this->queue->isEmpty()) {
                 $this->processEvent($this->queue->pop());
             }
         } finally {
             $this->isPublishing = false;
         }
     }
 }