diff options
| author | Rafael H. Schloming <rhs@apache.org> | 2008-05-09 19:26:28 +0000 |
|---|---|---|
| committer | Rafael H. Schloming <rhs@apache.org> | 2008-05-09 19:26:28 +0000 |
| commit | 603062f5008305e67446ef5b98c51cb2168e54d0 (patch) | |
| tree | 4d7bfeb24ae5ae01fa5555da17b90c7e9e82f3ef /python/qpid | |
| parent | b0f3edfa2a68ccf34aa7a555d0d37c2e17b8421b (diff) | |
| download | qpid-python-603062f5008305e67446ef5b98c51cb2168e54d0.tar.gz | |
QPID-1045 and QPID-1041: added a destination attribute to incoming queues, and added a start() method to incoming queues as syntactic sugar for the verbose message flow idiom
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@654918 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python/qpid')
| -rw-r--r-- | python/qpid/session.py | 13 | ||||
| -rw-r--r-- | python/qpid/spec010.py | 10 |
2 files changed, 20 insertions, 3 deletions
diff --git a/python/qpid/session.py b/python/qpid/session.py index a1103e0428..aa0446b941 100644 --- a/python/qpid/session.py +++ b/python/qpid/session.py @@ -75,7 +75,7 @@ class Session(Invoker): try: queue = self._incoming.get(destination) if queue == None: - queue = Queue() + queue = Incoming(self, destination) self._incoming[destination] = queue return queue finally: @@ -319,6 +319,17 @@ class Sender: for range in commands.ranges: self._completed.add(range.lower, range.upper) +class Incoming(Queue): + + def __init__(self, session, destination): + Queue.__init__(self) + self.session = session + self.destination = destination + + def start(self): + for unit in self.session.credit_unit.values(): + self.session.message_flow(self.destination, unit, 0xFFFFFFFF) + class Delegate: def __init__(self, session): diff --git a/python/qpid/spec010.py b/python/qpid/spec010.py index fb625eab65..58d305aa6c 100644 --- a/python/qpid/spec010.py +++ b/python/qpid/spec010.py @@ -170,10 +170,14 @@ class Enum: def __init__(self, name): self.name = name + self._names = () + self._values = () + + def values(self): + return self._values def __repr__(self): - return "%s(%s)" % (self.name, ", ".join([k for k in self.__dict__.keys() - if k != "name"])) + return "%s(%s)" % (self.name, ", ".join(self._names)) class Choice(Named, Node): @@ -192,6 +196,8 @@ class Choice(Named, Node): enum = Enum(node.name) node.spec.enums[node.name] = enum setattr(enum, self.name, self.value) + enum._names += (self.name,) + enum._values += (self.value,) class Composite(Type, Coded): |
