Beispiel #1
0
 /**
  * {@inheritdoc}
  */
 public function call(Identity $identity, Request $request)
 {
     $url = Url::parse($identity->getUrl(['amqps', 'amqp']));
     $reply = $this->invoker->call($this->createRequest($request), $url->getQueryParameter('exchange', $this->exchange), $request->getMethod());
     return new Promise(function ($timeout) use($reply) {
         return $this->createResponse($reply->resolve($timeout));
     }, function () use($reply) {
         $this->invoker->dequeue($reply);
     });
 }
 /**
  * @param array|string|Url $url
  *
  * @return string
  */
 private function hash($url)
 {
     if (is_string($url)) {
         $url = Url::parse($url);
     }
     if (is_array($url)) {
         $url = Url::import($url);
     }
     if (!$url instanceof Url) {
         throw new \InvalidArgumentException('Invalid URL type "%s"', gettype($url));
     }
     return md5(implode('::', [$url->getScheme(), $url->getHost(), $url->getVhost(), $url->getUser(), $url->getPassword()]));
 }