1Metadata-Version: 1.1 2Name: pika-pool 3Version: 0.1.3 4Summary: Pools for pikas. 5Home-page: https://github.com/bninja/pika-pool 6Author: egon 7Author-email: egon@gb.com 8License: BSD 9Description: ========= 10 pika-pool 11 ========= 12 13 .. image:: https://travis-ci.org/bninja/pika-pool.png 14 :target: https://travis-ci.org/bninja/pika-pool 15 16 .. image:: https://coveralls.io/repos/bninja/pika-pool/badge.png?branch=master 17 :target: https://coveralls.io/r/bninja/pika-pool?branch=master 18 19 Pika connection pooling inspired by: 20 21 - `flask-pika <https://github.com/WeatherDecisionTechnologies/flask-pika>`_ 22 - `sqlalchemy.pool.Pool <http://docs.sqlalchemy.org/en/latest/core/pooling.html#sqlalchemy.pool.Pool>`_ 23 24 Typically you'll go with local `shovels <https://www.rabbitmq.com/shovel.html>`_, `krazee-eyez kombu <http://bit.ly/1txcnnO>`_, etc. but this works too. 25 26 usage 27 ----- 28 29 Get it: 30 31 .. code:: bash 32 33 pip install pika-pool 34 35 and use it: 36 37 .. code:: python 38 39 import json 40 41 import pika 42 import pika_pool 43 44 params = pika.URLParameters( 45 'amqp://guest:guest@localhost:5672/?' 46 'socket_timeout=10&' 47 'connection_attempts=2' 48 ) 49 50 pool = pika_pool.QueuedPool( 51 create=lambda: pika.BlockingConnection(parameters=params), 52 max_size=10, 53 max_overflow=10, 54 timeout=10, 55 recycle=3600, 56 stale=45, 57 ) 58 59 with pool.acquire() as cxn: 60 cxn.channel.basic_publish( 61 body=json.dumps({ 62 'type': 'banana', 63 'description': 'they are yellow' 64 }), 65 exchange='', 66 routing_key='fruits', 67 properties=pika.BasicProperties( 68 content_type='application/json', 69 content_encoding='utf-8', 70 delivery_mode=2, 71 ) 72 ) 73 74 release 75 ------- 76 77 Tests pass: 78 79 .. code:: bash 80 81 py.test test.py --cov=pika_pool --cov-report term-missing 82 83 so update ``__version__`` in: 84 85 - ``__init__.py`` 86 87 then commit and tag it: 88 89 .. code:: bash 90 91 git commit -am "release v{version}" 92 git tag -a v{version} -m "release v{version}" 93 git push --tags 94 95 and `travis <https://travis-ci.org/bninja/pika-pool>`_ will publish it to `pypi <https://pypi.python.org/pypi/pika-pool/>`_. 96 97Platform: any 98Classifier: Environment :: Web Environment 99Classifier: Intended Audience :: Developers 100Classifier: License :: OSI Approved :: BSD License 101Classifier: Operating System :: OS Independent 102Classifier: Programming Language :: Python 103Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content 104Classifier: Topic :: Software Development :: Libraries :: Python Modules 105