/** * @param Request $request * * @return BindingInterface * * @throws RequestNotSupportedException */ private function findBinding(Request $request) { foreach ($this->bindings as $binding) { if ($binding->support($request)) { return $binding; } } throw RequestNotSupportedException::make($this->location->name(), $request); }
/** * @param LocationInterface $location * @param Request $request * * @return AMQPMessage */ private function createMessage(LocationInterface $location, Request $request) { $encoded = $this->encoder->encode($request->getArguments()); return new AMQPMessage($encoded->getBody(), ['content_type' => $encoded->getType(), 'message_id' => uniqid('', true), 'timestamp' => time(), 'application_headers' => new AMQPTable(array_merge($request->getHeaders(), ['to' => $location->name(), 'topic' => $request->getTopic(), 'version' => $request->getVersion()]))]); }
/** * @param LocationInterface $location * * @return string */ private function getRequestUrl(LocationInterface $location) { if ($url = $location->url(['https', 'http'])) { return $url; } throw new \InvalidArgumentException(sprintf('Endpoint "%s" does not support neither "https" nor "http" protocols', $location->name())); }