예제 #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;
         }
     }
 }
예제 #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;
         }
     }
 }