/**
  * Permanently remove durable subscription.
  *
  * @see inactive() if you just want to indicate that the consumer is offline now.
  * @return void
  */
 public function deactivate()
 {
     if ($this->active) {
         $this->inactive();
         $this->client->sendFrame($this->getProtocol()->getUnsubscribeFrame($this->subscription->getDestination(), $this->subscription->getSubscriptionId(), true));
         $this->active = false;
     }
 }
Exemple #2
0
 /**
  * @inheritdoc
  */
 public function __destruct()
 {
     IdGenerator::releaseId($this->subscription->getSubscriptionId());
 }
 /**
  * @inheritdoc
  */
 public function subscribe($destination, $selector, $ack, array $header = [])
 {
     $subscription = new Subscription($destination, $selector, $ack, IdGenerator::generateId(), $header);
     $this->getClient()->sendFrame($this->getProtocol()->getSubscribeFrame($subscription->getDestination(), $subscription->getSubscriptionId(), $subscription->getAck(), $subscription->getSelector())->addHeaders($header));
     $this->subscriptions[$subscription->getSubscriptionId()] = $subscription;
     return $subscription->getSubscriptionId();
 }