public function probeBinding(Binding $binding) { $bindings = $this->client->listBindingsByExchangeAndQueue($binding->vhost, $binding->source, $binding->destination); $retval = self::PROBE_ABSENT; foreach ($bindings as $foundBinding) { if ($binding->toJson() === $foundBinding->toJson()) { $retval = self::PROBE_OK; break; } } return $retval; }
public function addBinding(Binding $binding) { $uri = sprintf('/api/bindings/%s/e/%s/q/%s', urlencode($binding->vhost), urlencode($binding->source), urlencode($binding->destination)); try { $this->client->post($uri, array('Content-type' => 'application/json'), $binding->toJson())->send(); } catch (RequestException $e) { throw new RuntimeException('Unable to add binding', $e->getCode(), $e); } return $this; }
public function addBinding(Binding $binding) { $uri = sprintf('/api/bindings/%s/e/%s/q/%s', urlencode($binding->vhost), urlencode($binding->source), urlencode($binding->destination)); return $this->executeRequest('POST', $uri, $binding->toJson()); }