summaryrefslogtreecommitdiff
path: root/python/examples/request-response/client.py
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2007-12-05 15:19:45 +0000
committerGordon Sim <gsim@apache.org>2007-12-05 15:19:45 +0000
commit8e9a5272785f55ddc5ab2c395ccd648f0ae24ac1 (patch)
tree187ae4f332f78fdaad1c09e28b1e79bcb542f866 /python/examples/request-response/client.py
parent800014ce7d43d13a20a8fa810a1a4ac5dc510a98 (diff)
downloadqpid-python-8e9a5272785f55ddc5ab2c395ccd648f0ae24ac1.tar.gz
Updates to examples from jonathan.robie@redhat.com
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@601358 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python/examples/request-response/client.py')
-rw-r--r--python/examples/request-response/client.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/python/examples/request-response/client.py b/python/examples/request-response/client.py
index 23e9310509..bc0cf8a55a 100644
--- a/python/examples/request-response/client.py
+++ b/python/examples/request-response/client.py
@@ -22,7 +22,7 @@ def dump_queue(client, queue_name):
consumer_tag = queue_name # Use the queue name as the consumer tag - need a unique tag
queue = client.queue(consumer_tag)
- # Call basic_consume() to tell the broker to deliver messages
+ # Call message_subscribe() to tell the broker to deliver messages
# from the AMQP queue to a local client queue. The broker will
# start delivering messages as soon as basic_consume() is called.
@@ -46,8 +46,8 @@ def dump_queue(client, queue_name):
# Messages are not removed from the queue until they
- # are acknowledged. Using multiple=True, all messages
- # in the channel up to and including the one identified
+ # are acknowledged. Using cumulative=True, all messages
+ # in the session up to and including the one identified
# by the delivery tag are acknowledged. This is more efficient,
# because there are fewer network round-trips.
@@ -71,8 +71,11 @@ spec = qpid.spec.load(amqp_spec)
client = Client(host, port, spec)
client.start({"LOGIN": user, "PASSWORD": password})
+# Open the session. Save the session id.
+
session = client.session()
-session.session_open()
+session_info = session.session_open()
+session_id = session_info.session_id
#----- Main Body -- ----------------------------------------
@@ -80,7 +83,7 @@ session.session_open()
# same string as the name of the queue and the name of the routing
# key.
-replyTo = "ReplyTo:" # + base64.urlsafe_b64encode(session.session_id)
+replyTo = "ReplyTo:" + base64.urlsafe_b64encode(session_id)
session.queue_declare(queue=replyTo, exclusive=True)
session.queue_bind(exchange="amq.direct", queue=replyTo, routing_key=replyTo)
@@ -109,4 +112,4 @@ dump_queue(client, replyTo)
# Clean up before exiting so there are no open threads.
-session.session_close()
+session.session_close()