Thruway\Subscription\Subscription::unPauseForState PHP Method

unPauseForState() public method

public unPauseForState ( $lastPublicationId = null )
$lastPublicationId
    public function unPauseForState($lastPublicationId = null)
    {
        if (!$this->pausedForState) {
            throw new \Exception("Tried to unpaused subscription that was not paused");
        }
        $this->pausedForState = false;
        $this->processStateQueue($lastPublicationId);
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Gets and published the topics state to this subscription
  *
  * @param Subscription $subscription
  * @return mixed
  */
 public function publishState(Subscription $subscription)
 {
     //Pause all non-state building event messages
     $subscription->pauseForState();
     $sessionId = $subscription->getSession()->getSessionId();
     $this->clientSession->call($this->getProcedureName(), [$subscription->getUri(), $sessionId, $subscription->getOptions(), $subscription->getSession()->getAuthenticationDetails()])->then(function ($res) use($subscription) {
         $pubId = null;
         if (isset($res[0])) {
             $pubId = $res[0];
         }
         $subscription->unPauseForState($pubId);
     }, function ($error) use($subscription) {
         Logger::error($this, "Could not call '{$this->getProcedureName()}' when restoring state");
         $subscription->unPauseForState();
     });
 }