Propchange:
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/helloworld.py
------------------------------------------------------------------------------
svn:executable = *
Added:
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/helloworld_blocking.py
URL:
http://svn.apache.org/viewvc/qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/helloworld_blocking.py?rev=1681791&view=auto
==============================================================================
---
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/helloworld_blocking.py
(added)
+++
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/helloworld_blocking.py
Tue May 26 16:24:06 2015
@@ -0,0 +1,33 @@
+#!/usr/bin/env python
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+from proton import Message
+from proton.utils import BlockingConnection
+from proton.handlers import IncomingMessageHandler
+
+conn = BlockingConnection("localhost:5672")
+receiver = conn.create_receiver("examples")
+sender = conn.create_sender("examples")
+sender.send(Message(body=u"Hello World!"));
+msg = receiver.receive(timeout=30)
+print msg.body
+receiver.accept()
+conn.close()
+
Propchange:
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/helloworld_blocking.py
------------------------------------------------------------------------------
svn:executable = *
Added:
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/helloworld_direct.py
URL:
http://svn.apache.org/viewvc/qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/helloworld_direct.py?rev=1681791&view=auto
==============================================================================
---
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/helloworld_direct.py
(added)
+++
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/helloworld_direct.py
Tue May 26 16:24:06 2015
@@ -0,0 +1,47 @@
+#!/usr/bin/env python
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+from proton import Message
+from proton.handlers import MessagingHandler
+from proton.reactor import Container
+
+class HelloWorld(MessagingHandler):
+ def __init__(self, url):
+ super(HelloWorld, self).__init__()
+ self.url = url
+
+ def on_start(self, event):
+ self.acceptor = event.container.listen(self.url)
+ event.container.create_sender(self.url)
+
+ def on_sendable(self, event):
+ event.sender.send(Message(body=u"Hello World!"))
+ event.sender.close()
+
+ def on_message(self, event):
+ print event.message.body
+
+ def on_accepted(self, event):
+ event.connection.close()
+
+ def on_connection_closed(self, event):
+ self.acceptor.close()
+
+Container(HelloWorld("localhost:8888/examples")).run()
Propchange:
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/helloworld_direct.py
------------------------------------------------------------------------------
svn:executable = *
Added:
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/helloworld_direct_tornado.py
URL:
http://svn.apache.org/viewvc/qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/helloworld_direct_tornado.py?rev=1681791&view=auto
==============================================================================
---
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/helloworld_direct_tornado.py
(added)
+++
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/helloworld_direct_tornado.py
Tue May 26 16:24:06 2015
@@ -0,0 +1,47 @@
+#!/usr/bin/env python
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+from proton import Message
+from proton.handlers import MessagingHandler
+from proton_tornado import Container
+
+class HelloWorld(MessagingHandler):
+ def __init__(self, url):
+ super(HelloWorld, self).__init__()
+ self.url = url
+
+ def on_start(self, event):
+ self.acceptor = event.container.listen(self.url)
+ event.container.create_sender(self.url)
+
+ def on_sendable(self, event):
+ event.sender.send(Message(body=u"Hello World!"))
+ event.sender.close()
+
+ def on_message(self, event):
+ print event.message.body
+
+ def on_accepted(self, event):
+ event.connection.close()
+
+ def on_connection_closed(self, event):
+ self.acceptor.close()
+
+Container(HelloWorld("localhost:8888/examples")).run()
Propchange:
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/helloworld_direct_tornado.py
------------------------------------------------------------------------------
svn:executable = *
Added:
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/helloworld_tornado.py
URL:
http://svn.apache.org/viewvc/qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/helloworld_tornado.py?rev=1681791&view=auto
==============================================================================
---
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/helloworld_tornado.py
(added)
+++
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/helloworld_tornado.py
Tue May 26 16:24:06 2015
@@ -0,0 +1,44 @@
+#!/usr/bin/env python
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+from proton import Message
+from proton.handlers import MessagingHandler
+from proton_tornado import Container
+
+class HelloWorld(MessagingHandler):
+ def __init__(self, server, address):
+ super(HelloWorld, self).__init__()
+ self.server = server
+ self.address = address
+
+ def on_start(self, event):
+ conn = event.container.connect(self.server)
+ event.container.create_receiver(conn, self.address)
+ event.container.create_sender(conn, self.address)
+
+ def on_sendable(self, event):
+ event.sender.send(Message(body=u"Hello World!"))
+ event.sender.close()
+
+ def on_message(self, event):
+ print event.message.body
+ event.connection.close()
+
+Container(HelloWorld("localhost:5672", "examples")).run()
Propchange:
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/helloworld_tornado.py
------------------------------------------------------------------------------
svn:executable = *
Added:
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/index.md
URL:
http://svn.apache.org/viewvc/qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/index.md?rev=1681791&view=auto
==============================================================================
--- qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/index.md
(added)
+++ qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/index.md
Tue May 26 16:24:06 2015
@@ -0,0 +1,39 @@
+
+# Python AMQP Examples
+
+## Example files
+
+ - [helloworld.py](helloworld.py.html)
+ - [simple_send.py](simple_send.py)
+ - [simple_recv.py](simple_recv.py)
+ - [client.py](client.py)
+ - [server.py](server.py)
+ - [client_http.py](client_http.py)
+ - [helloworld_direct.py](helloworld_direct.py.html)
+ - [server_direct.py](server_direct.py)
+ - [direct_recv.py](direct_recv.py)
+ - [direct_send.py](direct_send.py)
+ - [helloworld_tornado.py](helloworld_tornado.py)
+ - [helloworld_direct_tornado.py](helloworld_direct_tornado.py)
+ - [helloworld_blocking.py](helloworld_blocking.py)
+ - [sync_client.py](sync_client.py)
+ - [queue_browser.py](queue_browser.py)
+ - [selected_recv.py](selected_recv.py)
+ - [recurring_timer.py](recurring_timer.py)
+ - [broker.py](broker.py)
+ - [tx_recv.py](tx_recv.py)
+ - [tx_send.py](tx_send.py)
+ - [server_tx.py](server_tx.py)
+ - [db_recv.py](db_recv.py)
+ - [db_send.py](db_send.py)
+
+
+## More information
+
+ -
[README](https://github.com/apache/qpid-proton/tree/0.9.1/examples/python/README)
+ - [Source
location](https://github.com/apache/qpid-proton/tree/0.9.1/examples/python)
+
+## Other examples
+
+ - [Messenger
examples](@current-proton-release-url@/messenger/python/examples/index.html)
+
Added:
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/proton_server.py
URL:
http://svn.apache.org/viewvc/qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/proton_server.py?rev=1681791&view=auto
==============================================================================
---
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/proton_server.py
(added)
+++
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/proton_server.py
Tue May 26 16:24:06 2015
@@ -0,0 +1,61 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+from proton import Message
+from proton.reactor import Container
+from proton.handlers import MessagingHandler
+
+class Server(MessagingHandler):
+ def __init__(self, host, address):
+ super(Server, self).__init__()
+ self.container = Container(self)
+ self.conn = self.container.connect(host)
+ self.receiver = self.container.create_receiver(self.conn, address)
+ self.senders = {}
+ self.relay = None
+
+ def on_message(self, event):
+ self.on_request(event.message.body, event.message.reply_to)
+
+ def on_connection_open(self, event):
+ if event.connection.remote_offered_capabilities and "ANONYMOUS-RELAY"
in event.connection.remote_offered_capabilities:
+ self.relay = self.container.create_sender(self.conn, None)
+
+ def on_connection_close(self, endpoint, error):
+ if error: print "Closed due to %s" % error
+ self.conn.close()
+
+ def run(self):
+ self.container.run()
+
+ def send(self, response, reply_to):
+ sender = self.relay
+ if not sender:
+ sender = self.senders.get(reply_to)
+ if not sender:
+ sender = self.container.create_sender(self.conn, reply_to)
+ self.senders[reply_to] = sender
+ msg = Message(body=response)
+ if self.relay:
+ msg.address = reply_to
+ sender.send_msg(msg)
+
+ def on_request(self, request, reply_to):
+ pass
+
Propchange:
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/proton_server.py
------------------------------------------------------------------------------
svn:executable = *
Added:
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/proton_tornado.py
URL:
http://svn.apache.org/viewvc/qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/proton_tornado.py?rev=1681791&view=auto
==============================================================================
---
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/proton_tornado.py
(added)
+++
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/proton_tornado.py
Tue May 26 16:24:06 2015
@@ -0,0 +1,114 @@
+#!/usr/bin/env python
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+import tornado.ioloop
+from proton.reactor import Container as BaseContainer
+from proton.handlers import IOHandler
+
+class TornadoLoopHandler:
+
+ def __init__(self, loop=None, handler_base=None):
+ self.loop = loop or tornado.ioloop.IOLoop.instance()
+ self.io = handler_base or IOHandler()
+ self.count = 0
+
+ def on_reactor_init(self, event):
+ self.reactor = event.reactor
+
+ def on_reactor_quiesced(self, event):
+ event.reactor.yield_()
+
+ def on_unhandled(self, name, event):
+ event.dispatch(self.io)
+
+ def _events(self, sel):
+ events = self.loop.ERROR
+ if sel.reading:
+ events |= self.loop.READ
+ if sel.writing:
+ events |= self.loop.WRITE
+ return events
+
+ def _schedule(self, sel):
+ if sel.deadline:
+ self.loop.add_timeout(sel.deadline, lambda: self.expired(sel))
+
+ def _expired(self, sel):
+ sel.expired()
+
+ def _process(self):
+ self.reactor.process()
+ if not self.reactor.quiesced:
+ self.loop.add_callback(self._process)
+
+ def _callback(self, sel, events):
+ if self.loop.READ & events:
+ sel.readable()
+ if self.loop.WRITE & events:
+ sel.writable()
+ self._process()
+
+ def on_selectable_init(self, event):
+ sel = event.context
+ if sel.fileno() >= 0:
+ self.loop.add_handler(sel.fileno(), lambda fd, events:
self._callback(sel, events), self._events(sel))
+ self._schedule(sel)
+ self.count += 1
+
+ def on_selectable_updated(self, event):
+ sel = event.context
+ if sel.fileno() > 0:
+ self.loop.update_handler(sel.fileno(), self._events(sel))
+ self._schedule(sel)
+
+ def on_selectable_final(self, event):
+ sel = event.context
+ if sel.fileno() > 0:
+ self.loop.remove_handler(sel.fileno())
+ sel.release()
+ self.count -= 1
+ if self.count == 0:
+ self.loop.add_callback(self._stop)
+
+ def _stop(self):
+ self.reactor.stop()
+ self.loop.stop()
+
+class Container(object):
+ def __init__(self, *handlers, **kwargs):
+ self.tornado_loop = kwargs.get('loop',
tornado.ioloop.IOLoop.instance())
+ kwargs['global_handler'] = TornadoLoopHandler(self.tornado_loop,
kwargs.get('handler_base', None))
+ self.container = BaseContainer(*handlers, **kwargs)
+
+ def initialise(self):
+ self.container.start()
+ self.container.process()
+
+ def run(self):
+ self.initialise()
+ self.tornado_loop.start()
+
+ def touch(self):
+ self._process()
+
+ def _process(self):
+ self.container.process()
+ if not self.container.quiesced:
+ self.tornado_loop.add_callback(self._process)
Propchange:
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/proton_tornado.py
------------------------------------------------------------------------------
svn:executable = *
Added:
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/queue_browser.py
URL:
http://svn.apache.org/viewvc/qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/queue_browser.py?rev=1681791&view=auto
==============================================================================
---
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/queue_browser.py
(added)
+++
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/queue_browser.py
Tue May 26 16:24:06 2015
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+from proton.reactor import Container, Copy
+from proton.handlers import MessagingHandler
+
+class Recv(MessagingHandler):
+ def __init__(self):
+ super(Recv, self).__init__()
+
+ def on_start(self, event):
+ conn = event.container.connect("localhost:5672")
+ event.container.create_receiver(conn, "examples", options=Copy())
+
+ def on_message(self, event):
+ print event.message
+ if event.receiver.queued == 0 and event.receiver.drained:
+ event.connection.close()
+
+try:
+ Container(Recv()).run()
+except KeyboardInterrupt: pass
+
+
+
Propchange:
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/queue_browser.py
------------------------------------------------------------------------------
svn:executable = *
Added:
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/recurring_timer.py
URL:
http://svn.apache.org/viewvc/qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/recurring_timer.py?rev=1681791&view=auto
==============================================================================
---
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/recurring_timer.py
(added)
+++
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/recurring_timer.py
Tue May 26 16:24:06 2015
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+from proton.reactor import Container, Handler
+
+class Recurring(Handler):
+ def __init__(self, period):
+ self.period = period
+
+ def on_reactor_init(self, event):
+ self.container = event.reactor
+ self.container.schedule(self.period, self)
+
+ def on_timer_task(self, event):
+ print "Tick..."
+ self.container.schedule(self.period, self)
+
+try:
+ container = Container(Recurring(1.0))
+ container.run()
+except KeyboardInterrupt:
+ container.stop()
+ print
+
+
Propchange:
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/recurring_timer.py
------------------------------------------------------------------------------
svn:executable = *
Added:
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/recurring_timer_tornado.py
URL:
http://svn.apache.org/viewvc/qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/recurring_timer_tornado.py?rev=1681791&view=auto
==============================================================================
---
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/recurring_timer_tornado.py
(added)
+++
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/recurring_timer_tornado.py
Tue May 26 16:24:06 2015
@@ -0,0 +1,44 @@
+#!/usr/bin/env python
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+import time
+from proton.reactor import Handler
+from proton_tornado import TornadoLoop
+
+class Recurring(Handler):
+ def __init__(self, period):
+ self.period = period
+
+ def on_start(self, event):
+ self.container = event.container
+ self.container.schedule(time.time() + self.period, subject=self)
+
+ def on_timer(self, event):
+ print "Tick..."
+ self.container.schedule(time.time() + self.period, subject=self)
+
+try:
+ container = TornadoLoop(Recurring(1.0))
+ container.run()
+except KeyboardInterrupt:
+ container.stop()
+ print
+
+
Propchange:
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/recurring_timer_tornado.py
------------------------------------------------------------------------------
svn:executable = *
Added:
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/selected_recv.py
URL:
http://svn.apache.org/viewvc/qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/selected_recv.py?rev=1681791&view=auto
==============================================================================
---
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/selected_recv.py
(added)
+++
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/selected_recv.py
Tue May 26 16:24:06 2015
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+from proton.reactor import Container, Selector
+from proton.handlers import MessagingHandler
+
+class Recv(MessagingHandler):
+ def __init__(self):
+ super(Recv, self).__init__()
+
+ def on_start(self, event):
+ conn = event.container.connect("localhost:5672")
+ event.container.create_receiver(conn, "examples",
options=Selector(u"colour = 'green'"))
+
+ def on_message(self, event):
+ print event.message.body
+
+try:
+ Container(Recv()).run()
+except KeyboardInterrupt: pass
+
+
+
Propchange:
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/selected_recv.py
------------------------------------------------------------------------------
svn:executable = *
Added:
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/server.py
URL:
http://svn.apache.org/viewvc/qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/server.py?rev=1681791&view=auto
==============================================================================
--- qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/server.py
(added)
+++ qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/server.py
Tue May 26 16:24:06 2015
@@ -0,0 +1,57 @@
+#!/usr/bin/env python
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+from proton import Message
+from proton.handlers import MessagingHandler
+from proton.reactor import Container
+
+class Server(MessagingHandler):
+ def __init__(self, url, address):
+ super(Server, self).__init__()
+ self.url = url
+ self.address = address
+ self.senders = {}
+
+ def on_start(self, event):
+ print "Listening on", self.url
+ self.container = event.container
+ self.conn = event.container.connect(self.url)
+ self.receiver = event.container.create_receiver(self.conn,
self.address)
+ self.relay = None
+
+ def on_connection_opened(self, event):
+ if event.connection.remote_offered_capabilities and 'ANONYMOUS-RELAY'
in event.connection.remote_offered_capabilities:
+ self.relay = self.container.create_sender(self.conn, None)
+
+ def on_message(self, event):
+ print "Received", event.message
+ sender = self.relay or self.senders.get(event.message.reply_to)
+ if not sender:
+ sender = self.container.create_sender(self.conn,
event.message.reply_to)
+ self.senders[event.message.reply_to] = sender
+ sender.send(Message(address=event.message.reply_to,
body=event.message.body.upper(),
+ correlation_id=event.message.correlation_id))
+
+try:
+ Container(Server("0.0.0.0:5672", "examples")).run()
+except KeyboardInterrupt: pass
+
+
+
Propchange:
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/server.py
------------------------------------------------------------------------------
svn:executable = *
Added:
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/server_direct.py
URL:
http://svn.apache.org/viewvc/qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/server_direct.py?rev=1681791&view=auto
==============================================================================
---
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/server_direct.py
(added)
+++
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/server_direct.py
Tue May 26 16:24:06 2015
@@ -0,0 +1,63 @@
+#!/usr/bin/env python
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+from proton import generate_uuid, Message
+from proton.handlers import MessagingHandler
+from proton.reactor import Container
+
+class Server(MessagingHandler):
+ def __init__(self, url):
+ super(Server, self).__init__()
+ self.url = url
+ self.senders = {}
+
+ def on_start(self, event):
+ print "Listening on", self.url
+ self.container = event.container
+ self.acceptor = event.container.listen(self.url)
+
+ def on_link_opening(self, event):
+ if event.link.is_sender:
+ if event.link.remote_source and event.link.remote_source.dynamic:
+ event.link.source.address = str(generate_uuid())
+ self.senders[event.link.source.address] = event.link
+ elif event.link.remote_target and event.link.remote_target.address:
+ event.link.target.address = event.link.remote_target.address
+ self.senders[event.link.remote_target.address] = event.link
+ elif event.link.remote_source:
+ event.link.source.address = event.link.remote_source.address
+ elif event.link.remote_target:
+ event.link.target.address = event.link.remote_target.address
+
+ def on_message(self, event):
+ print "Received", event.message
+ sender = self.senders.get(event.message.reply_to)
+ if not sender:
+ print "No link for reply"
+ return
+ sender.send(Message(address=event.message.reply_to,
body=event.message.body.upper(),
+ correlation_id=event.message.correlation_id))
+
+try:
+ Container(Server("0.0.0.0:8888")).run()
+except KeyboardInterrupt: pass
+
+
+
Propchange:
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/server_direct.py
------------------------------------------------------------------------------
svn:executable = *
Added:
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/server_tx.py
URL:
http://svn.apache.org/viewvc/qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/server_tx.py?rev=1681791&view=auto
==============================================================================
---
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/server_tx.py
(added)
+++
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/server_tx.py
Tue May 26 16:24:06 2015
@@ -0,0 +1,78 @@
+#!/usr/bin/env python
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+from proton import Message
+from proton.reactor import Container
+from proton.handlers import MessagingHandler, TransactionHandler
+
+class TxRequest(TransactionHandler):
+ def __init__(self, response, sender, request_delivery):
+ super(TxRequest, self).__init__()
+ self.response = response
+ self.sender = sender
+ self.request_delivery = request_delivery
+
+ def on_transaction_declared(self, event):
+ event.transaction.send(self.sender, self.response)
+ event.transaction.accept(self.request_delivery)
+ event.transaction.commit()
+
+ def on_transaction_committed(self, event):
+ print "Request processed successfully"
+
+ def on_transaction_aborted(self, event):
+ print "Request processing aborted"
+
+
+class TxServer(MessagingHandler):
+ def __init__(self, host, address):
+ super(TxServer, self).__init__(auto_accept=False)
+ self.host = host
+ self.address = address
+
+ def on_start(self, event):
+ self.container = event.container
+ self.conn = event.container.connect(self.host, reconnect=False)
+ self.receiver = event.container.create_receiver(self.conn,
self.address)
+ self.senders = {}
+ self.relay = None
+
+ def on_message(self, event):
+ sender = self.relay
+ if not sender:
+ sender = self.senders.get(event.message.reply_to)
+ if not sender:
+ sender = self.container.create_sender(self.conn,
event.message.reply_to)
+ self.senders[event.message.reply_to] = sender
+
+ response = Message(address=event.message.reply_to,
body=event.message.body.upper(),
+ correlation_id=event.message.correlation_id)
+ self.container.declare_transaction(self.conn,
handler=TxRequest(response, sender, event.delivery))
+
+ def on_connection_open(self, event):
+ if event.connection.remote_offered_capabilities and 'ANONYMOUS-RELAY'
in event.connection.remote_offered_capabilities:
+ self.relay = self.container.create_sender(self.conn, None)
+
+try:
+ Container(TxServer("localhost:5672", "examples")).run()
+except KeyboardInterrupt: pass
+
+
+
Propchange:
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/server_tx.py
------------------------------------------------------------------------------
svn:executable = *
Added:
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/simple_recv.py
URL:
http://svn.apache.org/viewvc/qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/simple_recv.py?rev=1681791&view=auto
==============================================================================
---
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/simple_recv.py
(added)
+++
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/simple_recv.py
Tue May 26 16:24:06 2015
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+import optparse
+from proton.handlers import MessagingHandler
+from proton.reactor import Container
+
+class Recv(MessagingHandler):
+ def __init__(self, url, count):
+ super(Recv, self).__init__()
+ self.url = url
+ self.expected = count
+ self.received = 0
+
+ def on_start(self, event):
+ event.container.create_receiver(self.url)
+
+ def on_message(self, event):
+ if event.message.id and event.message.id < self.received:
+ # ignore duplicate message
+ return
+ if self.expected == 0 or self.received < self.expected:
+ print event.message.body
+ self.received += 1
+ if self.received == self.expected:
+ event.receiver.close()
+ event.connection.close()
+
+parser = optparse.OptionParser(usage="usage: %prog [options]")
+parser.add_option("-a", "--address", default="localhost:5672/examples",
+ help="address from which messages are received (default
%default)")
+parser.add_option("-m", "--messages", type="int", default=100,
+ help="number of messages to receive; 0 receives indefinitely
(default %default)")
+opts, args = parser.parse_args()
+
+try:
+ Container(Recv(opts.address, opts.messages)).run()
+except KeyboardInterrupt: pass
+
+
+
Propchange:
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/simple_recv.py
------------------------------------------------------------------------------
svn:executable = *
Added:
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/simple_send.py
URL:
http://svn.apache.org/viewvc/qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/simple_send.py?rev=1681791&view=auto
==============================================================================
---
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/simple_send.py
(added)
+++
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/simple_send.py
Tue May 26 16:24:06 2015
@@ -0,0 +1,62 @@
+#!/usr/bin/env python
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+import optparse
+from proton import Message
+from proton.handlers import MessagingHandler
+from proton.reactor import Container
+
+class Send(MessagingHandler):
+ def __init__(self, url, messages):
+ super(Send, self).__init__()
+ self.url = url
+ self.sent = 0
+ self.confirmed = 0
+ self.total = messages
+
+ def on_start(self, event):
+ event.container.create_sender(self.url)
+
+ def on_sendable(self, event):
+ while event.sender.credit and self.sent < self.total:
+ msg = Message(id=(self.sent+1), body={'sequence':(self.sent+1)})
+ event.sender.send(msg)
+ self.sent += 1
+
+ def on_accepted(self, event):
+ self.confirmed += 1
+ if self.confirmed == self.total:
+ print "all messages confirmed"
+ event.connection.close()
+
+ def on_disconnected(self, event):
+ self.sent = self.confirmed
+
+parser = optparse.OptionParser(usage="usage: %prog [options]",
+ description="Send messages to the supplied
address.")
+parser.add_option("-a", "--address", default="localhost:5672/examples",
+ help="address to which messages are sent (default %default)")
+parser.add_option("-m", "--messages", type="int", default=100,
+ help="number of messages to send (default %default)")
+opts, args = parser.parse_args()
+
+try:
+ Container(Send(opts.address, opts.messages)).run()
+except KeyboardInterrupt: pass
Propchange:
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/simple_send.py
------------------------------------------------------------------------------
svn:executable = *
Added:
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/sync_client.py
URL:
http://svn.apache.org/viewvc/qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/sync_client.py?rev=1681791&view=auto
==============================================================================
---
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/sync_client.py
(added)
+++
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/sync_client.py
Tue May 26 16:24:06 2015
@@ -0,0 +1,54 @@
+#!/usr/bin/env python
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+"""
+Demonstrates the client side of the synchronous request-response pattern
+(also known as RPC or Remote Procecure Call) using proton.
+
+"""
+
+import optparse
+from proton import Message, Url, ConnectionException, Timeout
+from proton.utils import SyncRequestResponse, BlockingConnection
+from proton.handlers import IncomingMessageHandler
+import sys
+
+parser = optparse.OptionParser(usage="usage: %prog [options]",
+ description="Send requests to the supplied
address and print responses.")
+parser.add_option("-a", "--address", default="localhost:5672/examples",
+ help="address to which messages are sent (default %default)")
+parser.add_option("-t", "--timeout", type="float", default=5,
+ help="Give up after this time out (default %default)")
+opts, args = parser.parse_args()
+
+url = Url(opts.address)
+client = SyncRequestResponse(BlockingConnection(url, timeout=opts.timeout),
url.path)
+
+try:
+ REQUESTS= ["Twas brillig, and the slithy toves",
+ "Did gire and gymble in the wabe.",
+ "All mimsy were the borogroves,",
+ "And the mome raths outgrabe."]
+ for request in REQUESTS:
+ response = client.call(Message(body=request))
+ print "%s => %s" % (request, response.body)
+finally:
+ client.connection.close()
+
Propchange:
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/sync_client.py
------------------------------------------------------------------------------
svn:executable = *
Added:
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/tx_recv.py
URL:
http://svn.apache.org/viewvc/qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/tx_recv.py?rev=1681791&view=auto
==============================================================================
---
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/tx_recv.py
(added)
+++
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/tx_recv.py
Tue May 26 16:24:06 2015
@@ -0,0 +1,79 @@
+#!/usr/bin/env python
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+import optparse
+from proton import Url
+from proton.reactor import Container
+from proton.handlers import MessagingHandler, TransactionHandler
+
+class TxRecv(MessagingHandler, TransactionHandler):
+ def __init__(self, url, messages, batch_size):
+ super(TxRecv, self).__init__(prefetch=0, auto_accept=False)
+ self.url = Url(url)
+ self.expected = messages
+ self.batch_size = batch_size
+ self.current_batch = 0
+ self.committed = 0
+
+ def on_start(self, event):
+ self.container = event.container
+ self.conn = self.container.connect(self.url)
+ self.receiver = self.container.create_receiver(self.conn,
self.url.path)
+ self.container.declare_transaction(self.conn, handler=self)
+ self.transaction = None
+
+ def on_message(self, event):
+ print event.message.body
+ self.transaction.accept(event.delivery)
+ self.current_batch += 1
+ if self.current_batch == self.batch_size:
+ self.transaction.commit()
+ self.transaction = None
+
+ def on_transaction_declared(self, event):
+ self.receiver.flow(self.batch_size)
+ self.transaction = event.transaction
+
+ def on_transaction_committed(self, event):
+ self.committed += self.current_batch
+ self.current_batch = 0
+ if self.expected == 0 or self.committed < self.expected:
+ self.container.declare_transaction(self.conn, handler=self)
+ else:
+ event.connection.close()
+
+ def on_disconnected(self, event):
+ self.current_batch = 0
+
+parser = optparse.OptionParser(usage="usage: %prog [options]")
+parser.add_option("-a", "--address", default="localhost:5672/examples",
+ help="address from which messages are received (default
%default)")
+parser.add_option("-m", "--messages", type="int", default=100,
+ help="number of messages to receive; 0 receives indefinitely
(default %default)")
+parser.add_option("-b", "--batch-size", type="int", default=10,
+ help="number of messages in each transaction (default
%default)")
+opts, args = parser.parse_args()
+
+try:
+ Container(TxRecv(opts.address, opts.messages, opts.batch_size)).run()
+except KeyboardInterrupt: pass
+
+
+
Propchange:
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/tx_recv.py
------------------------------------------------------------------------------
svn:executable = *
Added:
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/tx_recv_interactive.py
URL:
http://svn.apache.org/viewvc/qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/tx_recv_interactive.py?rev=1681791&view=auto
==============================================================================
---
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/tx_recv_interactive.py
(added)
+++
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/tx_recv_interactive.py
Tue May 26 16:24:06 2015
@@ -0,0 +1,83 @@
+#!/usr/bin/env python
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+import sys
+import threading
+from proton.reactor import ApplicationEvent, Container
+from proton.handlers import MessagingHandler, TransactionHandler
+
+class TxRecv(MessagingHandler, TransactionHandler):
+ def __init__(self):
+ super(TxRecv, self).__init__(prefetch=0, auto_accept=False)
+
+ def on_start(self, event):
+ self.container = event.container
+ self.conn = self.container.connect("localhost:5672")
+ self.receiver = self.container.create_receiver(self.conn, "examples")
+ self.container.declare_transaction(self.conn, handler=self,
settle_before_discharge=True)
+ self.transaction = None
+
+ def on_message(self, event):
+ print event.message.body
+ self.transaction.accept(event.delivery)
+
+ def on_transaction_declared(self, event):
+ self.transaction = event.transaction
+ print "transaction declared"
+
+ def on_transaction_committed(self, event):
+ print "transaction committed"
+ self.container.declare_transaction(self.conn, handler=self)
+
+ def on_transaction_aborted(self, event):
+ print "transaction aborted"
+ self.container.declare_transaction(self.conn, handler=self)
+
+ def on_commit(self, event):
+ self.transaction.commit()
+
+ def on_abort(self, event):
+ self.transaction.abort()
+
+ def on_fetch(self, event):
+ self.receiver.flow(1)
+
+ def on_quit(self, event):
+ c = self.receiver.connection
+ self.receiver.close()
+ c.close()
+
+try:
+ reactor = Container(TxRecv())
+ events = reactor.get_event_trigger()
+ thread = threading.Thread(target=reactor.run)
+ thread.daemon=True
+ thread.start()
+
+ print "Enter 'fetch', 'commit' or 'abort'"
+ while True:
+ line = sys.stdin.readline()
+ if line:
+ events.trigger(ApplicationEvent(line.strip()))
+ else:
+ break
+except KeyboardInterrupt: pass
+
+
Propchange:
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/tx_recv_interactive.py
------------------------------------------------------------------------------
svn:executable = *
Added:
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/tx_send.py
URL:
http://svn.apache.org/viewvc/qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/tx_send.py?rev=1681791&view=auto
==============================================================================
---
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/tx_send.py
(added)
+++
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/tx_send.py
Tue May 26 16:24:06 2015
@@ -0,0 +1,88 @@
+#!/usr/bin/env python
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+import optparse
+from proton import Message, Url
+from proton.reactor import Container
+from proton.handlers import MessagingHandler, TransactionHandler
+
+class TxSend(MessagingHandler, TransactionHandler):
+ def __init__(self, url, messages, batch_size):
+ super(TxSend, self).__init__()
+ self.url = Url(url)
+ self.current_batch = 0
+ self.committed = 0
+ self.confirmed = 0
+ self.total = messages
+ self.batch_size = batch_size
+
+ def on_start(self, event):
+ self.container = event.container
+ self.conn = self.container.connect(self.url)
+ self.sender = self.container.create_sender(self.conn, self.url.path)
+ self.container.declare_transaction(self.conn, handler=self)
+ self.transaction = None
+
+ def on_transaction_declared(self, event):
+ self.transaction = event.transaction
+ self.send()
+
+ def on_sendable(self, event):
+ self.send()
+
+ def send(self):
+ while self.transaction and self.sender.credit and (self.committed +
self.current_batch) < self.total:
+ seq = self.committed + self.current_batch + 1
+ msg = Message(id=seq, body={'sequence':seq})
+ self.transaction.send(self.sender, msg)
+ self.current_batch += 1
+ if self.current_batch == self.batch_size:
+ self.transaction.commit()
+ self.transaction = None
+
+ def on_accepted(self, event):
+ if event.sender == self.sender:
+ self.confirmed += 1
+
+ def on_transaction_committed(self, event):
+ self.committed += self.current_batch
+ if self.committed == self.total:
+ print "all messages committed"
+ event.connection.close()
+ else:
+ self.current_batch = 0
+ self.container.declare_transaction(self.conn, handler=self)
+
+ def on_disconnected(self, event):
+ self.current_batch = 0
+
+parser = optparse.OptionParser(usage="usage: %prog [options]",
+ description="Send messages transactionally to
the supplied address.")
+parser.add_option("-a", "--address", default="localhost:5672/examples",
+ help="address to which messages are sent (default %default)")
+parser.add_option("-m", "--messages", type="int", default=100,
+ help="number of messages to send (default %default)")
+parser.add_option("-b", "--batch-size", type="int", default=10,
+ help="number of messages in each transaction (default
%default)")
+opts, args = parser.parse_args()
+
+try:
+ Container(TxSend(opts.address, opts.messages, opts.batch_size)).run()
+except KeyboardInterrupt: pass
Propchange:
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/examples/tx_send.py
------------------------------------------------------------------------------
svn:executable = *
Added:
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/tutorial/.buildinfo
URL:
http://svn.apache.org/viewvc/qpid/site/input/releases/qpid-proton-0.9.1/proton/python/tutorial/.buildinfo?rev=1681791&view=auto
==============================================================================
---
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/tutorial/.buildinfo
(added)
+++
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/tutorial/.buildinfo
Tue May 26 16:24:06 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/input/releases/qpid-proton-0.9.1/proton/python/tutorial/_sources/index.txt
URL:
http://svn.apache.org/viewvc/qpid/site/input/releases/qpid-proton-0.9.1/proton/python/tutorial/_sources/index.txt?rev=1681791&view=auto
==============================================================================
---
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/tutorial/_sources/index.txt
(added)
+++
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/tutorial/_sources/index.txt
Tue May 26 16:24:06 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/input/releases/qpid-proton-0.9.1/proton/python/tutorial/_sources/overview.txt
URL:
http://svn.apache.org/viewvc/qpid/site/input/releases/qpid-proton-0.9.1/proton/python/tutorial/_sources/overview.txt?rev=1681791&view=auto
==============================================================================
---
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/tutorial/_sources/overview.txt
(added)
+++
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/tutorial/_sources/overview.txt
Tue May 26 16:24:06 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/input/releases/qpid-proton-0.9.1/proton/python/tutorial/_sources/reference.txt
URL:
http://svn.apache.org/viewvc/qpid/site/input/releases/qpid-proton-0.9.1/proton/python/tutorial/_sources/reference.txt?rev=1681791&view=auto
==============================================================================
---
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/tutorial/_sources/reference.txt
(added)
+++
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/tutorial/_sources/reference.txt
Tue May 26 16:24:06 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/input/releases/qpid-proton-0.9.1/proton/python/tutorial/_sources/tutorial.txt
URL:
http://svn.apache.org/viewvc/qpid/site/input/releases/qpid-proton-0.9.1/proton/python/tutorial/_sources/tutorial.txt?rev=1681791&view=auto
==============================================================================
---
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/tutorial/_sources/tutorial.txt
(added)
+++
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/tutorial/_sources/tutorial.txt
Tue May 26 16:24:06 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/input/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/ajax-loader.gif
URL:
http://svn.apache.org/viewvc/qpid/site/input/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/ajax-loader.gif?rev=1681791&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
qpid/site/input/releases/qpid-proton-0.9.1/proton/python/tutorial/_static/ajax-loader.gif
------------------------------------------------------------------------------
svn:mime-type = image/gif
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]