a connection pool wrapper about async pika
Project description
Notice
just support twisted connection now
Usage
sample:
# with connection
from pika import URLParameters
from pooled_pika import PooledConn
AMQP_PARAM = URLParameters('amqp://user:pwd@amqpserver')
pooled_conn = PooledConn(AMQP_PARAM)
d = pooled_conn.acquire()
d.addCallbacks(_on_conn, _on_err_conn) # you will get a TwistedProtocolConnection object
d.addErrback(_on_err)
d.addBoth(pooled_conn.release) # must release what acquired anyway
or:
# with channel
from pika import URLParameters
from pooled_pika import PooledConn
AMQP_PARAM = URLParameters('amqp://user:pwd@amqpserver')
pooled_conn = PooledConn(AMQP_PARAM)
d = pooled_conn.acquire(channel=True)
d.addCallbacks(_on_channel, _on_err_channel) # you will get a TwistedChannel object
d.addErrback(_on_err)
d.addBoth(pooled_conn.release) # must release what acquired anyway
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
pooled-pika-0.3.0.tar.gz
(4.4 kB
view hashes)
Built Distribution
Close
Hashes for pooled_pika-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e2f05e350bfc72a9bdda63bcb32d92ff1f4a848a1a9baae9541729afe243bdfd |
|
MD5 | fd3bdc26fce6310d9a5f9f4db094816e |
|
BLAKE2b-256 | 6472b1e633732e20303cd59f9a807009bd7bfc5f6e0bd4fad026069396209085 |