Ejemplo n.º 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);
     });
 }
Ejemplo n.º 2
0
 /**
  * @todo: should also resolve jsonrpc and jsonrpcs schemas.
  *
  * {@inheritdoc}
  */
 public function call(Identity $identity, Request $request)
 {
     $url = $identity->getUrl(['https', 'http']);
     $headers = $this->getEncodedHeaders();
     $body = $this->getEncodedBody($request);
     /** @var HttpResponse $response */
     $response = $this->buzz->call($url, 'POST', $headers, $body);
     return new Promise(function () use($response) {
         $result = $this->getDecodedBody($response->getContent());
         return new Response($result);
     });
 }
Ejemplo n.º 3
0
 public function testGetUrlBySchema()
 {
     self::assertEquals('baz://localhost', $this->identity->getUrl(['too', 'baz', 'bar', 'foo']));
 }