RETIRED, further work has moved to Debian project infrastructure
Go to file
andrew 5b1d3b6503 Merge pull request #11 from bninja/cxn-str
fix cxn str to work w/ pika.BlockingConnection
2016-05-27 10:12:50 -07:00
.gitignore init 2014-08-19 22:37:39 -07:00
.travis.yml test w/ 3.x 2015-09-04 09:55:59 -07:00
LICENSE add bsd license 2016-05-27 09:31:33 -07:00
MANIFEST.in add bsd license 2016-05-27 09:31:33 -07:00
README.rst doc tweak 2015-09-04 10:27:57 -07:00
pika_pool.py fix cxn str to work w/ pika.BlockingConnection 2016-05-27 10:09:12 -07:00
setup.py accept py3 compat ver of pika 2015-09-04 10:04:12 -07:00
test.py fix cxn str to work w/ pika.BlockingConnection 2016-05-27 10:09:12 -07:00

README.rst

pika-pool

image

image

Pika connection pooling inspired by:

Typically you'll go with local shovels, krazee-eyez kombu, etc. but this works too.

usage

Get it:

pip install pika-pool

and use it:

import json

import pika
import pika_pool

params = pika.URLParameters(
   'amqp://guest:guest@localhost:5672/?'
   'socket_timeout=10&'
   'connection_attempts=2'
 )

 pool = pika_pool.QueuedPool(
     create=lambda: pika.BlockingConnection(parameters=params),
     max_size=10,
     max_overflow=10,
     timeout=10,
     recycle=3600,
     stale=45,
 )

 with pool.acquire() as cxn:
     cxn.channel.basic_publish(
         body=json.dumps({
             'type': 'banana',
             'description': 'they are yellow'
         }),
         exchange='',
         routing_key='fruits',
         properties=pika.BasicProperties(
             content_type='application/json',
             content_encoding='utf-8',
             delivery_mode=2,
         )
     )

release

Tests pass:

py.test test.py --cov=pika_pool --cov-report term-missing

so update __version__ in:

  • __init__.py

then commit and tag it:

git commit -am "release v{version}"
git tag -a v{version} -m "release v{version}"
git push --tags

and travis will publish it to pypi.