summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2007-02-13 21:52:30 +0000
committerAndrew Stitcher <astitcher@apache.org>2007-02-13 21:52:30 +0000
commit5d8e8d39e1e5e13d0753c53a8095f075895d01a1 (patch)
tree727d30e03ae1679827779560a32f11c12f32d4a5 /python
parent9517deedff9691dbe3429b0b917dfd4208b0b1b8 (diff)
downloadqpid-python-5d8e8d39e1e5e13d0753c53a8095f075895d01a1.tar.gz
r1111@fuschia: andrew | 2007-02-09 15:51:10 +0000
Removed currently unused request tracking logic r1125@fuschia: andrew | 2007-02-13 21:51:30 +0000 Implemented receiveing batched Message.ok in c++ broker Implemented batched response frames in python client code git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/qpid.0-9@507249 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python')
-rw-r--r--python/qpid/message.py9
-rw-r--r--python/qpid/peer.py13
-rw-r--r--python/tests/message.py12
3 files changed, 18 insertions, 16 deletions
diff --git a/python/qpid/message.py b/python/qpid/message.py
index 29c8654937..f80293180e 100644
--- a/python/qpid/message.py
+++ b/python/qpid/message.py
@@ -47,9 +47,12 @@ class Message:
else:
for r in self.method.responses:
if attr == r.name:
- result = lambda *args, **kwargs: \
- self.channel.respond(Method(r, r.arguments(*args, **kwargs)),
- self.frame)
+ def respond(*args, **kwargs):
+ batch=0
+ if kwargs.has_key("batchoffset"):
+ batch=kwargs.pop("batchoffset")
+ self.channel.respond(Method(r, r.arguments(*args, **kwargs)), batch, self.frame)
+ result = respond
break
else:
raise AttributeError(attr)
diff --git a/python/qpid/peer.py b/python/qpid/peer.py
index 9f9644f17d..3f7be699c2 100644
--- a/python/qpid/peer.py
+++ b/python/qpid/peer.py
@@ -155,12 +155,15 @@ class Responder:
self.write = writer
self.sequence = Sequence(1)
- def respond(self, method, request):
+ def respond(self, method, batch, request):
if isinstance(request, Method):
self.write(method)
else:
- # XXX: batching
- frame = Response(self.sequence.next(), request.id, 0, method)
+ # allow batching from frame at either end
+ if batch<0:
+ frame = Response(self.sequence.next(), request.id+batch, -batch, method)
+ else:
+ frame = Response(self.sequence.next(), request.id, batch, method)
self.write(frame)
class Closed(Exception): pass
@@ -237,8 +240,8 @@ class Channel:
def request(self, method, listener, content = None):
self.requester.request(method, listener, content)
- def respond(self, method, request):
- self.responder.respond(method, request)
+ def respond(self, method, batch, request):
+ self.responder.respond(method, batch, request)
def invoke(self, type, args, kwargs):
content = kwargs.pop("content", None)
diff --git a/python/tests/message.py b/python/tests/message.py
index d044d638e7..84219bfe25 100644
--- a/python/tests/message.py
+++ b/python/tests/message.py
@@ -384,16 +384,12 @@ class MessageTests(TestBase):
self.assertEqual(reply.method.name, "ok")
msg = self.client.queue(tag).get(timeout=1)
self.assertEqual("Message %d" % i, msg.body)
- # TODO: replace with below when we have batching
- if(i in [11, 12, 13, 15, 17, 19]):
+
+ if (i==13):
+ msg.ok(batchoffset=-2)
+ if(i in [15, 17, 19]):
msg.ok()
- #todo: when batching is available, test ack multiple
- #if(i == 13):
- # channel.message_ack(delivery_tag=reply.delivery_tag, multiple=True)
- #if(i in [15, 17, 19]):
- # channel.message_ack(delivery_tag=reply.delivery_tag)
-
reply = channel.message_get(no_ack=True, queue="test-get")
self.assertEqual(reply.method.klass.name, "message")
self.assertEqual(reply.method.name, "empty")