AMQPStorm connection pooling based on pika-pooling.
Project description
AMQPStorm connection pooling based on pika-pool.
usage
Get it:
pip install amqpstorm-pool
and use it:
import json
import amqpstorm
import amqpstorm_pool
uri = 'amqp://guest:guest@localhost:5672/%2F?heartbeat=60'
pool = amqpstorm_pool.QueuedPool(
create=lambda: amqpstorm.UriConnection(uri),
max_size=10,
max_overflow=10,
timeout=10,
recycle=3600,
stale=45,
)
with pool.acquire() as cxn:
cxn.channel.queue.declare('fruits')
cxn.channel.basic.publish(
body=json.dumps({
'type': 'banana',
'description': 'they are yellow'
}),
exchange='',
routing_key='fruits',
properties={
'content_type': 'text/plain',
'headers': {'key': 'value'}
}
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
AMQPStorm-Pool-1.0.1.tar.gz
(6.2 kB
view hashes)
Built Distribution
Close
Hashes for AMQPStorm_Pool-1.0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac25765a06234933c252089323611a44dce1cddd4d33355af044974ac68b3560 |
|
MD5 | 7c9b49a69aedeae3216c1e4ab7f8539f |
|
BLAKE2b-256 | 2164f4f0eac4cd2f510577ab10c87bb09e82a1605a6d34bb45cd9b908c96f382 |