Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_bindings_from_exchange, get_bindings_to_exchange, get_consumers #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions pyrabbit2/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class Client(object):
'definitions': 'definitions',
'extensions': 'extensions',
'cluster-name': 'cluster-name',
'consumers': 'consumers'
}

json_headers = {"content-type": "application/json"}
Expand Down Expand Up @@ -904,13 +905,22 @@ def get_queue_bindings(self, vhost, qname):
return bindings

def get_bindings_from_exchange(self, vhost, exch):
pass
vhost = quote(vhost, '')
exch = quote(exch, '')
path = Client.urls['bindings_by_source_exch'] % (vhost, exch)
bindings = self._call(path, 'GET')
return bindings

def get_bindings_to_exchange(self, vhost, exch):
pass
vhost = quote(vhost, '')
exch = quote(exch, '')
path = Client.urls['bindings_by_dest_exch'] % (vhost, exch)
bindings = self._call(path, 'GET')
return bindings
raise NotImplementedError

def get_bindings_between_exch_and_queue(self, vhost, exch, queue):
pass
raise NotImplementedError

def create_binding(self, vhost, exchange, queue, rt_key=None, args=None):
"""
Expand Down Expand Up @@ -1049,3 +1059,10 @@ def get_cluster_name(self):
"""
path = Client.urls['cluster-name']
return self._call(path, 'GET')

def get_consumers(self):
"""
Get A list of all consumers.
"""
path= Client.urls['consumers']
return self._call(path, 'GET')