Пример #1
0
 /**
  * @inheritdoc
  */
 public function subscribe(Consumer $consumer, ExecutionCondition $condition)
 {
     $this->stompClient->subscribe($consumer->getConfig()->getDestination());
     while ($condition->isValid()) {
         if ($message = $this->stompClient->readMessage(10)) {
             $condition->incrementMessagesCount();
             $result = $consumer->callback($message->getBody());
             if ($result) {
                 $message->ack();
             } else {
                 $message->nack();
             }
         }
     }
 }