Pools for pikas.
Project description
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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pika-pool-0.1.3.tar.gz
(4.7 kB
view details)
File details
Details for the file pika-pool-0.1.3.tar.gz
.
File metadata
- Download URL: pika-pool-0.1.3.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f3985888cc2788cdbd293a68a8b5702a9c955db6f7b8b551aeac91e7f32da397 |
|
MD5 | 0a3897e991aa3da948e03660313c1980 |
|
BLAKE2b-256 | ec4850c8f02a3eef4cb824bec50661ec1713040402cc1b2a38954dc977a59c23 |