You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gs...@apache.org on 2007/12/05 16:19:46 UTC

svn commit: r601358 - in /incubator/qpid/trunk/qpid/python/examples: direct/ fanout/ pubsub/ request-response/

Author: gsim
Date: Wed Dec  5 07:19:45 2007
New Revision: 601358

URL: http://svn.apache.org/viewvc?rev=601358&view=rev
Log:
Updates to examples from jonathan.robie@redhat.com


Modified:
    incubator/qpid/trunk/qpid/python/examples/direct/config_direct_exchange.py
    incubator/qpid/trunk/qpid/python/examples/direct/direct_consumer.py
    incubator/qpid/trunk/qpid/python/examples/fanout/config_fanout_exchange.py
    incubator/qpid/trunk/qpid/python/examples/fanout/fanout_producer.py
    incubator/qpid/trunk/qpid/python/examples/pubsub/topic_consumer.py
    incubator/qpid/trunk/qpid/python/examples/pubsub/topic_producer.py
    incubator/qpid/trunk/qpid/python/examples/request-response/client.py
    incubator/qpid/trunk/qpid/python/examples/request-response/server.py

Modified: incubator/qpid/trunk/qpid/python/examples/direct/config_direct_exchange.py
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/python/examples/direct/config_direct_exchange.py?rev=601358&r1=601357&r2=601358&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/python/examples/direct/config_direct_exchange.py (original)
+++ incubator/qpid/trunk/qpid/python/examples/direct/config_direct_exchange.py Wed Dec  5 07:19:45 2007
@@ -49,9 +49,5 @@
 
 #----- Cleanup ---------------------------------------------
 
-# Clean up before exiting so there are no open threads.
-#
-# Close Channel 1.
-# Close the connection using Channel 0, which is used for all connection methods.
 session.session_close()
 

Modified: incubator/qpid/trunk/qpid/python/examples/direct/direct_consumer.py
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/python/examples/direct/direct_consumer.py?rev=601358&r1=601357&r2=601358&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/python/examples/direct/direct_consumer.py (original)
+++ incubator/qpid/trunk/qpid/python/examples/direct/direct_consumer.py Wed Dec  5 07:19:45 2007
@@ -72,4 +72,4 @@
 # Clean up before exiting so there are no open threads.
 #
 
-# session.session_close()
+session.session_close()

Modified: incubator/qpid/trunk/qpid/python/examples/fanout/config_fanout_exchange.py
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/python/examples/fanout/config_fanout_exchange.py?rev=601358&r1=601357&r2=601358&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/python/examples/fanout/config_fanout_exchange.py (original)
+++ incubator/qpid/trunk/qpid/python/examples/fanout/config_fanout_exchange.py Wed Dec  5 07:19:45 2007
@@ -50,5 +50,5 @@
 #----- Cleanup ---------------------------------------------
 
 # Clean up before exiting so there are no open threads.
-# channel.session_close()
 
+session.session_close()

Modified: incubator/qpid/trunk/qpid/python/examples/fanout/fanout_producer.py
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/python/examples/fanout/fanout_producer.py?rev=601358&r1=601357&r2=601358&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/python/examples/fanout/fanout_producer.py (original)
+++ incubator/qpid/trunk/qpid/python/examples/fanout/fanout_producer.py Wed Dec  5 07:19:45 2007
@@ -46,4 +46,3 @@
 # Clean up before exiting so there are no open threads.
 
 session.session_close()
-

Modified: incubator/qpid/trunk/qpid/python/examples/pubsub/topic_consumer.py
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/python/examples/pubsub/topic_consumer.py?rev=601358&r1=601357&r2=601358&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/python/examples/pubsub/topic_consumer.py (original)
+++ incubator/qpid/trunk/qpid/python/examples/pubsub/topic_consumer.py Wed Dec  5 07:19:45 2007
@@ -74,15 +74,16 @@
 client.start({"LOGIN": user, "PASSWORD": password})
 
 session = client.session()
-session = session.session_open()  # keep the session object, we'll need the session id
+session_info = session.session_open() 
+session_id = session_info.session_id
 
 #----- Main Body -- ----------------------------------------
 
 
-news = "news" + base64.urlsafe_b64encode(session.session_id)
-weather = "weather" + base64.urlsafe_b64encode(session.session_id)
-usa = "usa" + base64.urlsafe_b64encode(session.session_id)
-europe = "europe" + base64.urlsafe_b64encode(session.session_id)
+news = "news" + base64.urlsafe_b64encode(session_id)
+weather = "weather" + base64.urlsafe_b64encode(session_id)
+usa = "usa" + base64.urlsafe_b64encode(session_id)
+europe = "europe" + base64.urlsafe_b64encode(session_id)
 
 session.queue_declare(queue=news, exclusive=True)
 session.queue_declare(queue=weather, exclusive=True)
@@ -113,8 +114,5 @@
 #----- Cleanup ------------------------------------------------
 
 # Clean up before exiting so there are no open threads.
-#
-# Close Channel 1.
 
 session.session_close()
-

Modified: incubator/qpid/trunk/qpid/python/examples/pubsub/topic_producer.py
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/python/examples/pubsub/topic_producer.py?rev=601358&r1=601357&r2=601358&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/python/examples/pubsub/topic_producer.py (original)
+++ incubator/qpid/trunk/qpid/python/examples/pubsub/topic_producer.py Wed Dec  5 07:19:45 2007
@@ -92,9 +92,5 @@
 #----- Cleanup --------------------------------------------
 
 # Clean up before exiting so there are no open threads.
-#
-# Close Channel 1.
-
 
 session.session_close()
-

Modified: incubator/qpid/trunk/qpid/python/examples/request-response/client.py
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/python/examples/request-response/client.py?rev=601358&r1=601357&r2=601358&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/python/examples/request-response/client.py (original)
+++ incubator/qpid/trunk/qpid/python/examples/request-response/client.py Wed Dec  5 07:19:45 2007
@@ -22,7 +22,7 @@
   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 @@
 
 
   #  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 @@
 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 @@
 # 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 @@
 
 # Clean up before exiting so there are no open threads.
 
-session.session_close()
+session.session_close() 

Modified: incubator/qpid/trunk/qpid/python/examples/request-response/server.py
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/python/examples/request-response/server.py?rev=601358&r1=601357&r2=601358&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/python/examples/request-response/server.py (original)
+++ incubator/qpid/trunk/qpid/python/examples/request-response/server.py Wed Dec  5 07:19:45 2007
@@ -41,7 +41,7 @@
 # Open Channel 1 so we can use it to manage our queue.
 
 session = client.session()
-session.session_open()  # keep the session object, we'll need the session id
+session.session_open() 
 
 #----- Main Body -- ----------------------------------------
 
@@ -82,8 +82,5 @@
 #----- Cleanup ------------------------------------------------
 
 # Clean up before exiting so there are no open threads.
-#
-# Close Channel 1.
 
 session.session_close()
-