public function requestForActionPermission($dontWait = null)
    {
        $sendSuccess = null;

        if (!$this->requestSocket) {
            $this->requestSocket = $this->context->getSocket(\ZMQ::SOCKET_REQ);
            $this->requestSocket->connect($this->getSocketsParams()->getRequestPulsarRsSocketAddress());
        }

        $requestDto = new PreparingRequestDto();

        if ($dontWait) {

            try {

                $this->requestSocket->send(serialize($requestDto));
                $sendSuccess = true;

            } catch (\Exception $e) {

                $this->logger->debug("Possibly work PerformerImitator.");

            }

            $this->becomeTheSubscriberReplyDto = unserialize($this->requestSocket->recv(\ZMQ::MODE_DONTWAIT));

        } else {

            $this->requestSocket->send(serialize($requestDto));

            $this->logger->debug("Performer send preparing request. Wait receive");
            //->recv() block execution until data will received
            $this->becomeTheSubscriberReplyDto = unserialize($this->requestSocket->recv());
            if (!$this->becomeTheSubscriberReplyDto->isAllowToStartSubscription()) {
                throw new PublisherPulsarException(PublisherPulsarExceptionsConstants::SUBSCRIPTION_IS_NOT_ALLOWED);
            }

            $this->logger->debug("Performer got allowing becomeTheSubscriberReply.");

        }

        return $sendSuccess;
    }
public function requestForActionPermission($dontWait = null)
    {
        $sendSuccess = null;

        if (!$this->requestSocket) {
            $this->requestSocket = $this->context->getSocket(\ZMQ::SOCKET_REQ);
            $this->requestSocket->connect($this->getSocketsParams()->getRequestPulsarRsSocketAddress());
        }

        $requestDto = new PreparingRequestDto();

        if ($dontWait) {

            try {

                $this->requestSocket->send(serialize($requestDto));
                $sendSuccess = true;

            } catch (\Exception $e) {

                $this->logger->debug("Possibly work PerformerImitator.");

            }

            $this->becomeTheSubscriberReplyDto = unserialize($this->requestSocket->recv(\ZMQ::MODE_DONTWAIT));

        } else {

            $this->requestSocket->send(serialize($requestDto));

            $this->logger->debug("Performer send preparing request. Wait receive");
            //->recv() block execution until data will received
            $this->becomeTheSubscriberReplyDto = unserialize($this->requestSocket->recv());
            if (!$this->becomeTheSubscriberReplyDto->isAllowToStartSubscription()) {
                throw new PublisherPulsarException(PublisherPulsarExceptionsConstants::SUBSCRIPTION_IS_NOT_ALLOWED);
            }

            $this->logger->debug("Performer got allowing becomeTheSubscriberReply.");

        }

        return $sendSuccess;
    }
public function requestForActionPermission ( $ dontWait = null ) { $ sendSuccess = null ; if ( ! $ this -> requestSocket ) { $ this -> requestSocket = $ this -> context -> getSocket ( \ ZMQ :: SOCKET_REQ ) ; $ this -> requestSocket -> connect ( $ this -> getSocketsParams ( ) -> getRequestPulsarRsSocketAddress ( ) ) ; } $ requestDto = new PreparingRequestDto ( ) ; if ( $ dontWait ) { try { $ this -> requestSocket -> send ( serialize ( $ requestDto ) ) ; $ sendSuccess = true ; } catch ( \ Exception $ e ) { $ this -> logger -> debug ( "Possibly work PerformerImitator." ) ; } $ this -> becomeTheSubscriberReplyDto = unserialize ( $ this -> requestSocket -> recv ( \ ZMQ :: MODE_DONTWAIT ) ) ; } else { $ this -> requestSocket -> send ( serialize ( $ requestDto ) ) ; $ this -> logger -> debug ( "Performer send preparing request. Wait receive" ) ; //->recv() block execution until data will received $ this -> becomeTheSubscriberReplyDto = unserialize ( $ this -> requestSocket -> recv ( ) ) ; if ( ! $ this -> becomeTheSubscriberReplyDto -> isAllowToStartSubscription ( ) ) { throw new PublisherPulsarException ( PublisherPulsarExceptionsConstants :: SUBSCRIPTION_IS_NOT_ALLOWED ) ; } $ this -> logger -> debug ( "Performer got allowing becomeTheSubscriberReply." ) ; } return $ sendSuccess ; }
Make a request and wait response in blocking mode. After response
start subscription.
@return null
Make a request and wait response in blocking mode . After response start subscription .