Skip to content

Commit

Permalink
modified | modifeid msgr.py and added __getattr__ method to expose un…
Browse files Browse the repository at this point in the history
…derlying queue's attributes.
  • Loading branch information
copyrighthero committed Mar 21, 2018
1 parent 2eed1d4 commit b372374
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions msgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ def __call__(
# dispatch a message
self.put(message, *args, **kwargs)

def __getattr__(self, key):
"""
Expose queue's attributes
:param key: str, the attribute name
:return: mixed, the queue properties
"""
return self._queue.__getattribute__(key)

def put(self, message, *args, **kwargs):
"""
Put one message to queue with blocking
Expand Down Expand Up @@ -149,6 +157,14 @@ def __call__(
# dispatch a message
self.dispatch(message, *args, **kwargs)

def __getattr__(self, key):
"""
Expose job queue's attributes.
:param key: str, the attribute name
:return: mixed, the attributes.
"""
return self._job.__getattribute__(key)

def acquire(
self,
block = True, timeout = None,
Expand Down

0 comments on commit b372374

Please sign in to comment.