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 2015/05/26 17:10:13 UTC
svn commit: r1681771 [1/5] - in
/qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial: ./
_sources/ _static/
Author: gsim
Date: Tue May 26 15:10:12 2015
New Revision: 1681771
URL: http://svn.apache.org/r1681771
Log:
Added tutorial for python binding in 0.9.1 release
Added:
qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/
qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/.buildinfo
qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_sources/
qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_sources/index.txt
qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_sources/overview.txt
qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_sources/reference.txt
qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_sources/tutorial.txt
qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/
qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/ajax-loader.gif (with props)
qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/basic.css
qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/comment-bright.png (with props)
qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/comment-close.png (with props)
qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/comment.png (with props)
qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/contents.png (with props)
qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/doctools.js
qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/down-pressed.png (with props)
qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/down.png (with props)
qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/file.png (with props)
qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/jquery.js
qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/minus.png (with props)
qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/navigation.png (with props)
qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/plus.png (with props)
qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/pygments.css
qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/searchtools.js
qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/sphinxdoc.css
qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/underscore.js
qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/up-pressed.png (with props)
qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/up.png (with props)
qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/websupport.js
qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/genindex.html
qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/index.html
qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/objects.inv (with props)
qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/overview.html
qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/reference.html
qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/search.html
qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/searchindex.js
qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/tutorial.html
Added: qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/.buildinfo
URL: http://svn.apache.org/viewvc/qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/.buildinfo?rev=1681771&view=auto
==============================================================================
--- qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/.buildinfo (added)
+++ qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/.buildinfo Tue May 26 15:10:12 2015
@@ -0,0 +1,4 @@
+# Sphinx build info version 1
+# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
+config: c28d42903b953706bec928f16f1746ff
+tags: fbb0d17656682115ca4d033fb2f83ba1
Added: qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_sources/index.txt
URL: http://svn.apache.org/viewvc/qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_sources/index.txt?rev=1681771&view=auto
==============================================================================
--- qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_sources/index.txt (added)
+++ qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_sources/index.txt Tue May 26 15:10:12 2015
@@ -0,0 +1,24 @@
+.. Apache Qpid Proton documentation master file, created by
+ sphinx-quickstart on Mon Feb 16 14:13:09 2015.
+ You can adapt this file completely to your liking, but it should at least
+ contain the root `toctree` directive.
+
+Welcome to Apache Qpid Proton's documentation!
+==============================================
+
+Contents:
+
+.. toctree::
+ :maxdepth: 2
+
+ tutorial
+ overview
+ reference
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
+
Added: qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_sources/overview.txt
URL: http://svn.apache.org/viewvc/qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_sources/overview.txt?rev=1681771&view=auto
==============================================================================
--- qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_sources/overview.txt (added)
+++ qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_sources/overview.txt Tue May 26 15:10:12 2015
@@ -0,0 +1,161 @@
+############
+API Overview
+############
+
+=========================
+An overview of the model
+=========================
+
+Messages are transferred between connected peers over 'links'. At the
+sending peer the link is called a sender. At the receiving peer it is
+called a receiver. Messages are sent by senders and received by
+receivers. Links may have named 'source' and 'target' addresses (for
+example to identify the queue from which message were to be received
+or to which they were to be sent).
+
+Links are established over sessions. Sessions are established over
+connections. Connections are (generally) established between two
+uniquely identified containers. Though a connection can have multiple
+sessions, often this is not needed. The container API allows you to
+ignore sessions unless you actually require them.
+
+The sending of a message over a link is called a delivery. The message
+is the content sent, including all meta-data such as headers and
+annotations. The delivery is the protocol exchange associated with the
+transfer of that content.
+
+To indicate that a delivery is complete, either the sender or the
+receiver 'settles' it. When the other side learns that it has been
+settled, they will no longer communicate about that delivery. The
+receiver can also indicate whether they accept or reject the
+message.
+
+Three different delivery levels or 'guarantees' can be achieved:
+at-most-once, at-least-once or exactly-once. See
+:ref:`delivery-guarantees` for more detail.
+
+=======================================================
+A summary of the most commonly used classes and members
+=======================================================
+
+A brief summary of some of the key classes follows. A more complete
+reference is available in :doc:`reference`.
+
+The :py:class:`~proton.reactor.Container` class is a convenient entry
+point into the API, allowing connections and links to be
+established. Applications are structured as one or more event
+handlers. Handlers can be set at Container, Connection, or Link
+scope. Messages are sent by establishing an approprate sender and
+invoking its :py:meth:`~proton.Sender.send()` method. This is
+typically done when the sender is sendable, a condition indicated by
+the :py:meth:`~proton.handlers.MessagingHandler.on_sendable()` event, to
+avoid execessive build up of messages. Messages can be received by
+establishing an appropriate receiver and handling the
+:py:meth:`~proton.handlers.MessagingHandler.on_message()` event.
+
+.. autoclass:: proton.reactor.Container
+ :show-inheritance: proton.reactor.Reactor
+ :members: connect, create_receiver, create_sender, run, schedule
+ :undoc-members:
+
+ .. py:attribute:: container_id
+
+ The identifier used to identify this container in any
+ connections it establishes. Container names should be
+ unique. By default a UUID will be used.
+
+ The :py:meth:`~proton.reactor.Container.connect()` method returns
+ an instance of :py:class:`~proton.Connection`, the
+ :py:meth:`~proton.reactor.Container.create_receiver()` method
+ returns an instance of :py:class:`~proton.Receiver` and the
+ :py:meth:`~proton.reactor.Container.create_sender()` method
+ returns an instance of :py:class:`~proton.Sender`.
+
+.. autoclass:: proton.Connection
+ :members: open, close, state, session, hostname, container,
+ remote_container, remote_desired_capabilities, remote_hostname, remote_offered_capabilities , remote_properties
+ :undoc-members:
+
+.. autoclass:: proton.Receiver
+ :show-inheritance: proton.Link
+ :members: flow, recv, drain, draining
+ :undoc-members:
+
+.. autoclass:: proton.Sender
+ :show-inheritance: proton.Link
+ :members: offered, send
+ :undoc-members:
+
+.. autoclass:: proton.Link
+ :members: name, state, is_sender, is_receiver,
+ credit, queued, session, connection,
+ source, target, remote_source, remote_target
+ :undoc-members:
+
+ The :py:meth:`~proton.Link.source()`,
+ :py:meth:`~proton.Link.target()`,
+ :py:meth:`~proton.Link.remote_source()` and
+ :py:meth:`~proton.Link.remote_target()` methods all return an
+ instance of :py:class:`~proton.Terminus`.
+
+
+.. autoclass:: proton.Delivery
+ :members: update, settle, settled, remote_state, local_state, partial, readable, writable,
+ link, session, connection
+ :undoc-members:
+
+.. autoclass:: proton.handlers.MessagingHandler
+ :members: on_start, on_reactor_init,
+ on_message,
+ on_accepted,
+ on_rejected,
+ on_settled,
+ on_sendable,
+ on_connection_error,
+ on_link_error,
+ on_session_error,
+ on_disconnected,
+ accept, reject, release, settle
+ :undoc-members:
+
+.. autoclass:: proton.Event
+ :members: delivery, link, receiver, sender, session, connection, reactor, context
+ :undoc-members:
+
+.. autoclass:: proton.Message
+ :members: address, id, priority, subject, ttl, reply_to, correlation_id, durable, user_id,
+ content_type, content_encoding, creation_time, expiry_time, delivery_count, first_acquirer,
+ group_id, group_sequence, reply_to_group_id,
+ send, recv, encode, decode
+ :undoc-members:
+
+.. autoclass:: proton.Terminus
+ :members: address, dynamic, properties, capabilities, filter
+ :undoc-members:
+
+.. _delivery-guarantees:
+
+===================
+Delivery guarantees
+===================
+
+For at-most-once, the sender settles the message as soon as it sends
+it. If the connection is lost before the message is received by the
+receiver, the message will not be delivered.
+
+For at-least-once, the receiver accepts and settles the message on
+receipt. If the connection is lost before the sender is informed of
+the settlement, then the delivery is considered in-doubt and should be
+retried. This will ensure it eventually gets delivered (provided of
+course the connection and link can be reestablished). It may mean that
+it is delivered multiple times though.
+
+Finally, for exactly-once, the receiver accepts the message but
+doesn't settle it. The sender settles once it is aware that the
+receiver accepted it. In this way the receiver retains knowledge of an
+accepted message until it is sure the sender knows it has been
+accepted. If the connection is lost before settlement, the receiver
+informs the sender of all the unsettled deliveries it knows about, and
+from this the sender can deduce which need to be redelivered. The
+sender likewise informs the receiver which deliveries it knows about,
+from which the receiver can deduce which have already been settled.
Added: qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_sources/reference.txt
URL: http://svn.apache.org/viewvc/qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_sources/reference.txt?rev=1681771&view=auto
==============================================================================
--- qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_sources/reference.txt (added)
+++ qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_sources/reference.txt Tue May 26 15:10:12 2015
@@ -0,0 +1,44 @@
+#############
+API Reference
+#############
+
+proton Package
+==============
+
+:mod:`proton` Package
+---------------------
+
+.. automodule:: proton.__init__
+ :noindex:
+ :members:
+ :undoc-members:
+ :show-inheritance:
+ :exclude-members: Messenger, Url
+
+:mod:`reactor` Module
+---------------------
+
+.. automodule:: proton.reactor
+ :noindex:
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`handlers` Module
+----------------------
+
+.. automodule:: proton.handlers
+ :noindex:
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`utils` Module
+-------------------
+
+.. automodule:: proton.utils
+ :noindex:
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
Added: qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_sources/tutorial.txt
URL: http://svn.apache.org/viewvc/qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_sources/tutorial.txt?rev=1681771&view=auto
==============================================================================
--- qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_sources/tutorial.txt (added)
+++ qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_sources/tutorial.txt Tue May 26 15:10:12 2015
@@ -0,0 +1,301 @@
+########
+Tutorial
+########
+
+============
+Hello World!
+============
+
+Tradition dictates that we start with hello world! However rather than
+simply striving for the shortest program possible, we'll aim for a
+more illustrative example while still restricting the functionality to
+sending and receiving a single message.
+
+.. literalinclude:: ../../../../../examples/python/helloworld.py
+ :lines: 21-
+ :linenos:
+
+You can see the import of :py:class:`~proton.reactor.Container` from ``proton.reactor`` on the
+second line. This is a class that makes programming with proton a
+little easier for the common cases. It includes within it an event
+loop, and programs written using this utility are generally structured
+to react to various events. This reactive style is particularly suited
+to messaging applications.
+
+To be notified of a particular event, you define a class with the
+appropriately name method on it. That method is then called by the
+event loop when the event occurs.
+
+We define a class here, ``HelloWorld``, which handles the key events of
+interest in sending and receiving a message.
+
+The ``on_start()`` method is called when the event loop first
+starts. We handle that by establishing our connection (line 12), a
+sender over which to send the message (line 13) and a receiver over
+which to receive it back again (line 14).
+
+The ``on_sendable()`` method is called when message can be transferred
+over the associated sender link to the remote peer. We send out our
+``Hello World!`` message (line 17), then close the sender (line 18) as
+we only want to send one message. The closing of the sender will
+prevent further calls to ``on_sendable()``.
+
+The ``on_message()`` method is called when a message is
+received. Within that we simply print the body of the message (line
+21) and then close the connection (line 22).
+
+Now that we have defined the logic for handling these events, we
+create an instance of a :py:class:`~proton.reactor.Container`, pass it
+our handler and then enter the event loop by calling
+:py:meth:`~proton.reactor.Container.run()`. At this point control
+passes to the container instance, which will make the appropriate
+callbacks to any defined handlers.
+
+To run the example you will need to have a broker (or similar)
+accepting connections on that url either with a queue (or topic)
+matching the given address or else configured to create such a queue
+(or topic) dynamically. There is a simple broker.py script included
+alongside the examples that can be used for this purpose if
+desired. (It is also written using the API described here, and as such
+gives an example of a slightly more involved application).
+
+====================
+Hello World, Direct!
+====================
+
+Though often used in conjunction with a broker, AMQP does not
+*require* this. It also allows senders and receivers can communicate
+directly if desired.
+
+Let's modify our example to demonstrate this.
+
+.. literalinclude:: ../../../../../examples/python/helloworld_direct.py
+ :lines: 21-
+ :emphasize-lines: 11,21-22,24-25
+ :linenos:
+
+The first difference, on line 11, is that rather than creating a
+receiver on the same connection as our sender, we listen for incoming
+connections by invoking the
+:py:meth:`~proton.reactor.Container.listen()` method on the
+container.
+
+As we only need then to initiate one link, the sender, we can do that
+by passing in a url rather than an existing connection, and the
+connection will also be automatically established for us.
+
+We send the message in response to the ``on_sendable()`` callback and
+print the message out in response to the ``on_message()`` callback
+exactly as before.
+
+However we also handle two new events. We now close the connection
+from the senders side once the message has been accepted (line
+22). The acceptance of the message is an indication of successful
+transfer to the peer. We are notified of that event through the
+``on_accepted()`` callback. Then, once the connection has been closed,
+of which we are notified through the ``on_closed()`` callback, we stop
+accepting incoming connections (line 25) at which point there is no
+work to be done and the event loop exits, and the run() method will
+return.
+
+So now we have our example working without a broker involved!
+
+=============================
+Asynchronous Send and Receive
+=============================
+
+Of course, these ``HelloWorld!`` examples are very artificial,
+communicating as they do over a network connection but with the same
+process. A more realistic example involves communication between
+separate processes (which could indeed be running on completely
+separate machines).
+
+Let's separate the sender from the receiver, and let's transfer more than
+a single message between them.
+
+We'll start with a simple sender.
+
+.. literalinclude:: ../../../../../examples/python/simple_send.py
+ :lines: 21-
+ :linenos:
+
+As with the previous example, we define the application logic in a
+class that handles various events. As before, we use the
+``on_start()`` event to establish our sender link over which we will
+transfer messages and the ``on_sendable()`` event to know when we can
+transfer our messages.
+
+Because we are transferring more than one message, we need to keep
+track of how many we have sent. We'll use a ``sent`` member variable
+for that. The ``total`` member variable will hold the number of
+messages we want to send.
+
+AMQP defines a credit-based flow control mechanism. Flow control
+allows the receiver to control how many messages it is prepared to
+receive at a given time and thus prevents any component being
+overwhelmed by the number of messages it is sent.
+
+In the ``on_sendable()`` callback, we check that our sender has credit
+before sending messages. We also check that we haven't already sent
+the required number of messages.
+
+The ``send()`` call on line 20 is of course asynchronous. When it
+returns the message has not yet actually been transferred across the
+network to the receiver. By handling the ``on_accepted()`` event, we
+can get notified when the receiver has received and accepted the
+message. In our example we use this event to track the confirmation of
+the messages we have sent. We only close the connection and exit when
+the receiver has received all the messages we wanted to send.
+
+If we are disconnected after a message is sent and before it has been
+confirmed by the receiver, it is said to be ``in doubt``. We don't
+know whether or not it was received. In this example, we will handle
+that by resending any in-doubt messages. This is known as an
+'at-least-once' guarantee, since each message should eventually be
+received at least once, though a given message may be received more
+than once (i.e. duplicates are possible). In the ``on_disconnected()``
+callback, we reset the sent count to reflect only those that have been
+confirmed. The library will automatically try to reconnect for us, and
+when our sender is sendable again, we can restart from the point we
+know the receiver got to.
+
+Now let's look at the corresponding receiver:
+
+.. literalinclude:: ../../../../../examples/python/simple_recv.py
+ :lines: 21-
+ :linenos:
+
+Here we handle the ``on_start()`` by creating our receiver, much like
+we did for the sender. We also handle the ``on_message()`` event for
+received messages and print the message out as in the ``Hello World!``
+examples. However we add some logic to allow the receiver to wait for
+a given number of messages, then to close the connection and exit. We
+also add some logic to check for and ignore duplicates, using a simple
+sequential id scheme.
+
+Again, though sending between these two examples requires some sort of
+intermediary process (e.g. a broker), AMQP allows us to send messages
+directly between two processes without this if we so wish. In that
+case one or other of the processes needs to accept incoming socket
+connections. Let's create a modified version of the receiving example
+that does this:
+
+.. literalinclude:: ../../../../../examples/python/direct_recv.py
+ :lines: 21-
+ :emphasize-lines: 13,25
+ :linenos:
+
+There are only two differences here. On line 13, instead of initiating
+a link (and implicitly a connection), we listen for incoming
+connections. On line 25, when we have received all the expected
+messages, we then stop listening for incoming connections by closing
+the acceptor object.
+
+You can use the original send example now to send to this receiver
+directly. (Note: you will need to stop any broker that is listening on
+the 5672 port, or else change the port used by specifying a different
+address to each example via the -a command line switch).
+
+We could equally well modify the original sender to allow the original
+receiver to connect to it. Again that just requires two modifications:
+
+.. literalinclude:: ../../../../../examples/python/direct_send.py
+ :lines: 21-
+ :emphasize-lines: 15,28
+ :linenos:
+
+As with the modified receiver, instead of initiating establishment of
+a link, we listen for incoming connections on line 15 and then on line
+28, when we have received confirmation of all the messages we sent, we
+can close the acceptor in order to exit. The symmetry in the
+underlying AMQP that enables this is quite unique and elegant, and in
+reflecting this the proton API provides a flexible toolkit for
+implementing all sorts of interesting intermediaries (the broker.py
+script provided as a simple broker for testing purposes provides an
+example of this).
+
+To try this modified sender, run the original receiver against it.
+
+================
+Request/Response
+================
+
+A common pattern is to send a request message and expect a response
+message in return. AMQP has special support for this pattern. Let's
+have a look at a simple example. We'll start with the 'server',
+i.e. the program that will process the request and send the
+response. Note that we are still using a broker in this example.
+
+Our server will provide a very simple service: it will respond with
+the body of the request converted to uppercase.
+
+.. literalinclude:: ../../../../../examples/python/server.py
+ :lines: 21-
+ :linenos:
+
+The code here is not too different from the simple receiver
+example. When we receive a request however, we look at the
+:py:attr:`~proton.Message.reply_to` address on the
+:py:class:`~proton.Message` and create a sender for that over which to
+send the response. We'll cache the senders incase we get further
+requests with the same reply_to.
+
+Now let's create a simple client to test this service out.
+
+.. literalinclude:: ../../../../../examples/python/client.py
+ :lines: 21-
+ :linenos:
+
+As well as sending requests, we need to be able to get back the
+responses. We create a receiver for that (see line 14), but we don't
+specify an address, we set the dynamic option which tells the broker
+we are connected to to create a temporary address over which we can
+receive our responses.
+
+We need to use the address allocated by the broker as the reply_to
+address of our requests, so we can't send them until the broker has
+confirmed our receiving link has been set up (at which point we will
+have our allocated address). To do that, we add an
+``on_link_opened()`` method to our handler class, and if the link
+associated with event is the receiver, we use that as the trigger to
+send our first request.
+
+Again, we could avoid having any intermediary process here if we
+wished. The following code implementas a server to which the client
+above could connect directly without any need for a broker or similar.
+
+.. literalinclude:: ../../../../../examples/python/server_direct.py
+ :lines: 21-
+ :linenos:
+
+Though this requires some more extensive changes than the simple
+sending and receiving examples, the essence of the program is still
+the same. Here though, rather than the server establishing a link for
+the response, it relies on the link that the client established, since
+that now comes in directly to the server process.
+
+Miscellaneous
+=============
+
+Many brokers offer the ability to consume messages based on a
+'selector' that defines which messages are of interest based on
+particular values of the headers. The following example shows how that
+can be achieved:
+
+.. literalinclude:: ../../../../../examples/python/selected_recv.py
+ :lines: 21-
+ :emphasize-lines: 10
+ :linenos:
+
+When creating the receiver, we specify a Selector object as an
+option. The options argument can take a single object or a
+list. Another option that is sometimes of interest when using a broker
+is the ability to 'browse' the messages on a queue, rather than
+consumig them. This is done in AMQP by specifying a distribution mode
+of 'copy' (instead of 'move' which is the expected default for
+queues). An example of that is shown next:
+
+.. literalinclude:: ../../../../../examples/python/queue_browser.py
+ :lines: 21-
+ :emphasize-lines: 10
+ :linenos:
Added: qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/ajax-loader.gif
URL: http://svn.apache.org/viewvc/qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/ajax-loader.gif?rev=1681771&view=auto
==============================================================================
Binary file - no diff available.
Propchange: qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/ajax-loader.gif
------------------------------------------------------------------------------
svn:mime-type = image/gif
Added: qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/basic.css
URL: http://svn.apache.org/viewvc/qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/basic.css?rev=1681771&view=auto
==============================================================================
--- qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/basic.css (added)
+++ qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/basic.css Tue May 26 15:10:12 2015
@@ -0,0 +1,540 @@
+/*
+ * basic.css
+ * ~~~~~~~~~
+ *
+ * Sphinx stylesheet -- basic theme.
+ *
+ * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
+ * :license: BSD, see LICENSE for details.
+ *
+ */
+
+/* -- main layout ----------------------------------------------------------- */
+
+div.clearer {
+ clear: both;
+}
+
+/* -- relbar ---------------------------------------------------------------- */
+
+div.related {
+ width: 100%;
+ font-size: 90%;
+}
+
+div.related h3 {
+ display: none;
+}
+
+div.related ul {
+ margin: 0;
+ padding: 0 0 0 10px;
+ list-style: none;
+}
+
+div.related li {
+ display: inline;
+}
+
+div.related li.right {
+ float: right;
+ margin-right: 5px;
+}
+
+/* -- sidebar --------------------------------------------------------------- */
+
+div.sphinxsidebarwrapper {
+ padding: 10px 5px 0 10px;
+}
+
+div.sphinxsidebar {
+ float: left;
+ width: 230px;
+ margin-left: -100%;
+ font-size: 90%;
+}
+
+div.sphinxsidebar ul {
+ list-style: none;
+}
+
+div.sphinxsidebar ul ul,
+div.sphinxsidebar ul.want-points {
+ margin-left: 20px;
+ list-style: square;
+}
+
+div.sphinxsidebar ul ul {
+ margin-top: 0;
+ margin-bottom: 0;
+}
+
+div.sphinxsidebar form {
+ margin-top: 10px;
+}
+
+div.sphinxsidebar input {
+ border: 1px solid #98dbcc;
+ font-family: sans-serif;
+ font-size: 1em;
+}
+
+div.sphinxsidebar #searchbox input[type="text"] {
+ width: 170px;
+}
+
+div.sphinxsidebar #searchbox input[type="submit"] {
+ width: 30px;
+}
+
+img {
+ border: 0;
+}
+
+/* -- search page ----------------------------------------------------------- */
+
+ul.search {
+ margin: 10px 0 0 20px;
+ padding: 0;
+}
+
+ul.search li {
+ padding: 5px 0 5px 20px;
+ background-image: url(file.png);
+ background-repeat: no-repeat;
+ background-position: 0 7px;
+}
+
+ul.search li a {
+ font-weight: bold;
+}
+
+ul.search li div.context {
+ color: #888;
+ margin: 2px 0 0 30px;
+ text-align: left;
+}
+
+ul.keywordmatches li.goodmatch a {
+ font-weight: bold;
+}
+
+/* -- index page ------------------------------------------------------------ */
+
+table.contentstable {
+ width: 90%;
+}
+
+table.contentstable p.biglink {
+ line-height: 150%;
+}
+
+a.biglink {
+ font-size: 1.3em;
+}
+
+span.linkdescr {
+ font-style: italic;
+ padding-top: 5px;
+ font-size: 90%;
+}
+
+/* -- general index --------------------------------------------------------- */
+
+table.indextable {
+ width: 100%;
+}
+
+table.indextable td {
+ text-align: left;
+ vertical-align: top;
+}
+
+table.indextable dl, table.indextable dd {
+ margin-top: 0;
+ margin-bottom: 0;
+}
+
+table.indextable tr.pcap {
+ height: 10px;
+}
+
+table.indextable tr.cap {
+ margin-top: 10px;
+ background-color: #f2f2f2;
+}
+
+img.toggler {
+ margin-right: 3px;
+ margin-top: 3px;
+ cursor: pointer;
+}
+
+div.modindex-jumpbox {
+ border-top: 1px solid #ddd;
+ border-bottom: 1px solid #ddd;
+ margin: 1em 0 1em 0;
+ padding: 0.4em;
+}
+
+div.genindex-jumpbox {
+ border-top: 1px solid #ddd;
+ border-bottom: 1px solid #ddd;
+ margin: 1em 0 1em 0;
+ padding: 0.4em;
+}
+
+/* -- general body styles --------------------------------------------------- */
+
+a.headerlink {
+ visibility: hidden;
+}
+
+h1:hover > a.headerlink,
+h2:hover > a.headerlink,
+h3:hover > a.headerlink,
+h4:hover > a.headerlink,
+h5:hover > a.headerlink,
+h6:hover > a.headerlink,
+dt:hover > a.headerlink {
+ visibility: visible;
+}
+
+div.body p.caption {
+ text-align: inherit;
+}
+
+div.body td {
+ text-align: left;
+}
+
+.field-list ul {
+ padding-left: 1em;
+}
+
+.first {
+ margin-top: 0 !important;
+}
+
+p.rubric {
+ margin-top: 30px;
+ font-weight: bold;
+}
+
+img.align-left, .figure.align-left, object.align-left {
+ clear: left;
+ float: left;
+ margin-right: 1em;
+}
+
+img.align-right, .figure.align-right, object.align-right {
+ clear: right;
+ float: right;
+ margin-left: 1em;
+}
+
+img.align-center, .figure.align-center, object.align-center {
+ display: block;
+ margin-left: auto;
+ margin-right: auto;
+}
+
+.align-left {
+ text-align: left;
+}
+
+.align-center {
+ text-align: center;
+}
+
+.align-right {
+ text-align: right;
+}
+
+/* -- sidebars -------------------------------------------------------------- */
+
+div.sidebar {
+ margin: 0 0 0.5em 1em;
+ border: 1px solid #ddb;
+ padding: 7px 7px 0 7px;
+ background-color: #ffe;
+ width: 40%;
+ float: right;
+}
+
+p.sidebar-title {
+ font-weight: bold;
+}
+
+/* -- topics ---------------------------------------------------------------- */
+
+div.topic {
+ border: 1px solid #ccc;
+ padding: 7px 7px 0 7px;
+ margin: 10px 0 10px 0;
+}
+
+p.topic-title {
+ font-size: 1.1em;
+ font-weight: bold;
+ margin-top: 10px;
+}
+
+/* -- admonitions ----------------------------------------------------------- */
+
+div.admonition {
+ margin-top: 10px;
+ margin-bottom: 10px;
+ padding: 7px;
+}
+
+div.admonition dt {
+ font-weight: bold;
+}
+
+div.admonition dl {
+ margin-bottom: 0;
+}
+
+p.admonition-title {
+ margin: 0px 10px 5px 0px;
+ font-weight: bold;
+}
+
+div.body p.centered {
+ text-align: center;
+ margin-top: 25px;
+}
+
+/* -- tables ---------------------------------------------------------------- */
+
+table.docutils {
+ border: 0;
+ border-collapse: collapse;
+}
+
+table.docutils td, table.docutils th {
+ padding: 1px 8px 1px 5px;
+ border-top: 0;
+ border-left: 0;
+ border-right: 0;
+ border-bottom: 1px solid #aaa;
+}
+
+table.field-list td, table.field-list th {
+ border: 0 !important;
+}
+
+table.footnote td, table.footnote th {
+ border: 0 !important;
+}
+
+th {
+ text-align: left;
+ padding-right: 5px;
+}
+
+table.citation {
+ border-left: solid 1px gray;
+ margin-left: 1px;
+}
+
+table.citation td {
+ border-bottom: none;
+}
+
+/* -- other body styles ----------------------------------------------------- */
+
+ol.arabic {
+ list-style: decimal;
+}
+
+ol.loweralpha {
+ list-style: lower-alpha;
+}
+
+ol.upperalpha {
+ list-style: upper-alpha;
+}
+
+ol.lowerroman {
+ list-style: lower-roman;
+}
+
+ol.upperroman {
+ list-style: upper-roman;
+}
+
+dl {
+ margin-bottom: 15px;
+}
+
+dd p {
+ margin-top: 0px;
+}
+
+dd ul, dd table {
+ margin-bottom: 10px;
+}
+
+dd {
+ margin-top: 3px;
+ margin-bottom: 10px;
+ margin-left: 30px;
+}
+
+dt:target, .highlighted {
+ background-color: #fbe54e;
+}
+
+dl.glossary dt {
+ font-weight: bold;
+ font-size: 1.1em;
+}
+
+.field-list ul {
+ margin: 0;
+ padding-left: 1em;
+}
+
+.field-list p {
+ margin: 0;
+}
+
+.refcount {
+ color: #060;
+}
+
+.optional {
+ font-size: 1.3em;
+}
+
+.versionmodified {
+ font-style: italic;
+}
+
+.system-message {
+ background-color: #fda;
+ padding: 5px;
+ border: 3px solid red;
+}
+
+.footnote:target {
+ background-color: #ffa;
+}
+
+.line-block {
+ display: block;
+ margin-top: 1em;
+ margin-bottom: 1em;
+}
+
+.line-block .line-block {
+ margin-top: 0;
+ margin-bottom: 0;
+ margin-left: 1.5em;
+}
+
+.guilabel, .menuselection {
+ font-family: sans-serif;
+}
+
+.accelerator {
+ text-decoration: underline;
+}
+
+.classifier {
+ font-style: oblique;
+}
+
+abbr, acronym {
+ border-bottom: dotted 1px;
+ cursor: help;
+}
+
+/* -- code displays --------------------------------------------------------- */
+
+pre {
+ overflow: auto;
+ overflow-y: hidden; /* fixes display issues on Chrome browsers */
+}
+
+td.linenos pre {
+ padding: 5px 0px;
+ border: 0;
+ background-color: transparent;
+ color: #aaa;
+}
+
+table.highlighttable {
+ margin-left: 0.5em;
+}
+
+table.highlighttable td {
+ padding: 0 0.5em 0 0.5em;
+}
+
+tt.descname {
+ background-color: transparent;
+ font-weight: bold;
+ font-size: 1.2em;
+}
+
+tt.descclassname {
+ background-color: transparent;
+}
+
+tt.xref, a tt {
+ background-color: transparent;
+ font-weight: bold;
+}
+
+h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt {
+ background-color: transparent;
+}
+
+.viewcode-link {
+ float: right;
+}
+
+.viewcode-back {
+ float: right;
+ font-family: sans-serif;
+}
+
+div.viewcode-block:target {
+ margin: -1px -10px;
+ padding: 0 10px;
+}
+
+/* -- math display ---------------------------------------------------------- */
+
+img.math {
+ vertical-align: middle;
+}
+
+div.body div.math p {
+ text-align: center;
+}
+
+span.eqno {
+ float: right;
+}
+
+/* -- printout stylesheet --------------------------------------------------- */
+
+@media print {
+ div.document,
+ div.documentwrapper,
+ div.bodywrapper {
+ margin: 0 !important;
+ width: 100%;
+ }
+
+ div.sphinxsidebar,
+ div.related,
+ div.footer,
+ #top-link {
+ display: none;
+ }
+}
\ No newline at end of file
Added: qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/comment-bright.png
URL: http://svn.apache.org/viewvc/qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/comment-bright.png?rev=1681771&view=auto
==============================================================================
Binary file - no diff available.
Propchange: qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/comment-bright.png
------------------------------------------------------------------------------
svn:mime-type = image/png
Added: qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/comment-close.png
URL: http://svn.apache.org/viewvc/qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/comment-close.png?rev=1681771&view=auto
==============================================================================
Binary file - no diff available.
Propchange: qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/comment-close.png
------------------------------------------------------------------------------
svn:mime-type = image/png
Added: qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/comment.png
URL: http://svn.apache.org/viewvc/qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/comment.png?rev=1681771&view=auto
==============================================================================
Binary file - no diff available.
Propchange: qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/comment.png
------------------------------------------------------------------------------
svn:mime-type = image/png
Added: qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/contents.png
URL: http://svn.apache.org/viewvc/qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/contents.png?rev=1681771&view=auto
==============================================================================
Binary file - no diff available.
Propchange: qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/contents.png
------------------------------------------------------------------------------
svn:mime-type = image/png
Added: qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/doctools.js
URL: http://svn.apache.org/viewvc/qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/doctools.js?rev=1681771&view=auto
==============================================================================
--- qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/doctools.js (added)
+++ qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/doctools.js Tue May 26 15:10:12 2015
@@ -0,0 +1,247 @@
+/*
+ * doctools.js
+ * ~~~~~~~~~~~
+ *
+ * Sphinx JavaScript utilities for all documentation.
+ *
+ * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
+ * :license: BSD, see LICENSE for details.
+ *
+ */
+
+/**
+ * select a different prefix for underscore
+ */
+$u = _.noConflict();
+
+/**
+ * make the code below compatible with browsers without
+ * an installed firebug like debugger
+if (!window.console || !console.firebug) {
+ var names = ["log", "debug", "info", "warn", "error", "assert", "dir",
+ "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace",
+ "profile", "profileEnd"];
+ window.console = {};
+ for (var i = 0; i < names.length; ++i)
+ window.console[names[i]] = function() {};
+}
+ */
+
+/**
+ * small helper function to urldecode strings
+ */
+jQuery.urldecode = function(x) {
+ return decodeURIComponent(x).replace(/\+/g, ' ');
+}
+
+/**
+ * small helper function to urlencode strings
+ */
+jQuery.urlencode = encodeURIComponent;
+
+/**
+ * This function returns the parsed url parameters of the
+ * current request. Multiple values per key are supported,
+ * it will always return arrays of strings for the value parts.
+ */
+jQuery.getQueryParameters = function(s) {
+ if (typeof s == 'undefined')
+ s = document.location.search;
+ var parts = s.substr(s.indexOf('?') + 1).split('&');
+ var result = {};
+ for (var i = 0; i < parts.length; i++) {
+ var tmp = parts[i].split('=', 2);
+ var key = jQuery.urldecode(tmp[0]);
+ var value = jQuery.urldecode(tmp[1]);
+ if (key in result)
+ result[key].push(value);
+ else
+ result[key] = [value];
+ }
+ return result;
+};
+
+/**
+ * small function to check if an array contains
+ * a given item.
+ */
+jQuery.contains = function(arr, item) {
+ for (var i = 0; i < arr.length; i++) {
+ if (arr[i] == item)
+ return true;
+ }
+ return false;
+};
+
+/**
+ * highlight a given string on a jquery object by wrapping it in
+ * span elements with the given class name.
+ */
+jQuery.fn.highlightText = function(text, className) {
+ function highlight(node) {
+ if (node.nodeType == 3) {
+ var val = node.nodeValue;
+ var pos = val.toLowerCase().indexOf(text);
+ if (pos >= 0 && !jQuery(node.parentNode).hasClass(className)) {
+ var span = document.createElement("span");
+ span.className = className;
+ span.appendChild(document.createTextNode(val.substr(pos, text.length)));
+ node.parentNode.insertBefore(span, node.parentNode.insertBefore(
+ document.createTextNode(val.substr(pos + text.length)),
+ node.nextSibling));
+ node.nodeValue = val.substr(0, pos);
+ }
+ }
+ else if (!jQuery(node).is("button, select, textarea")) {
+ jQuery.each(node.childNodes, function() {
+ highlight(this);
+ });
+ }
+ }
+ return this.each(function() {
+ highlight(this);
+ });
+};
+
+/**
+ * Small JavaScript module for the documentation.
+ */
+var Documentation = {
+
+ init : function() {
+ this.fixFirefoxAnchorBug();
+ this.highlightSearchWords();
+ this.initIndexTable();
+ },
+
+ /**
+ * i18n support
+ */
+ TRANSLATIONS : {},
+ PLURAL_EXPR : function(n) { return n == 1 ? 0 : 1; },
+ LOCALE : 'unknown',
+
+ // gettext and ngettext don't access this so that the functions
+ // can safely bound to a different name (_ = Documentation.gettext)
+ gettext : function(string) {
+ var translated = Documentation.TRANSLATIONS[string];
+ if (typeof translated == 'undefined')
+ return string;
+ return (typeof translated == 'string') ? translated : translated[0];
+ },
+
+ ngettext : function(singular, plural, n) {
+ var translated = Documentation.TRANSLATIONS[singular];
+ if (typeof translated == 'undefined')
+ return (n == 1) ? singular : plural;
+ return translated[Documentation.PLURALEXPR(n)];
+ },
+
+ addTranslations : function(catalog) {
+ for (var key in catalog.messages)
+ this.TRANSLATIONS[key] = catalog.messages[key];
+ this.PLURAL_EXPR = new Function('n', 'return +(' + catalog.plural_expr + ')');
+ this.LOCALE = catalog.locale;
+ },
+
+ /**
+ * add context elements like header anchor links
+ */
+ addContextElements : function() {
+ $('div[id] > :header:first').each(function() {
+ $('<a class="headerlink">\u00B6</a>').
+ attr('href', '#' + this.id).
+ attr('title', _('Permalink to this headline')).
+ appendTo(this);
+ });
+ $('dt[id]').each(function() {
+ $('<a class="headerlink">\u00B6</a>').
+ attr('href', '#' + this.id).
+ attr('title', _('Permalink to this definition')).
+ appendTo(this);
+ });
+ },
+
+ /**
+ * workaround a firefox stupidity
+ */
+ fixFirefoxAnchorBug : function() {
+ if (document.location.hash && $.browser.mozilla)
+ window.setTimeout(function() {
+ document.location.href += '';
+ }, 10);
+ },
+
+ /**
+ * highlight the search words provided in the url in the text
+ */
+ highlightSearchWords : function() {
+ var params = $.getQueryParameters();
+ var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : [];
+ if (terms.length) {
+ var body = $('div.body');
+ window.setTimeout(function() {
+ $.each(terms, function() {
+ body.highlightText(this.toLowerCase(), 'highlighted');
+ });
+ }, 10);
+ $('<p class="highlight-link"><a href="javascript:Documentation.' +
+ 'hideSearchWords()">' + _('Hide Search Matches') + '</a></p>')
+ .appendTo($('#searchbox'));
+ }
+ },
+
+ /**
+ * init the domain index toggle buttons
+ */
+ initIndexTable : function() {
+ var togglers = $('img.toggler').click(function() {
+ var src = $(this).attr('src');
+ var idnum = $(this).attr('id').substr(7);
+ $('tr.cg-' + idnum).toggle();
+ if (src.substr(-9) == 'minus.png')
+ $(this).attr('src', src.substr(0, src.length-9) + 'plus.png');
+ else
+ $(this).attr('src', src.substr(0, src.length-8) + 'minus.png');
+ }).css('display', '');
+ if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) {
+ togglers.click();
+ }
+ },
+
+ /**
+ * helper function to hide the search marks again
+ */
+ hideSearchWords : function() {
+ $('#searchbox .highlight-link').fadeOut(300);
+ $('span.highlighted').removeClass('highlighted');
+ },
+
+ /**
+ * make the url absolute
+ */
+ makeURL : function(relativeURL) {
+ return DOCUMENTATION_OPTIONS.URL_ROOT + '/' + relativeURL;
+ },
+
+ /**
+ * get the current relative url
+ */
+ getCurrentURL : function() {
+ var path = document.location.pathname;
+ var parts = path.split(/\//);
+ $.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() {
+ if (this == '..')
+ parts.pop();
+ });
+ var url = parts.join('/');
+ return path.substring(url.lastIndexOf('/') + 1, path.length - 1);
+ }
+};
+
+// quick alias for translations
+_ = Documentation.gettext;
+
+$(document).ready(function() {
+ Documentation.init();
+});
Added: qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/down-pressed.png
URL: http://svn.apache.org/viewvc/qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/down-pressed.png?rev=1681771&view=auto
==============================================================================
Binary file - no diff available.
Propchange: qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/down-pressed.png
------------------------------------------------------------------------------
svn:mime-type = image/png
Added: qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/down.png
URL: http://svn.apache.org/viewvc/qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/down.png?rev=1681771&view=auto
==============================================================================
Binary file - no diff available.
Propchange: qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/down.png
------------------------------------------------------------------------------
svn:mime-type = image/png
Added: qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/file.png
URL: http://svn.apache.org/viewvc/qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/file.png?rev=1681771&view=auto
==============================================================================
Binary file - no diff available.
Propchange: qpid/site/docs/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/file.png
------------------------------------------------------------------------------
svn:mime-type = image/png
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org