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.2.0.tar.gz
(3.4 kB
view hashes)
Built Distribution
Close
Hashes for pooled_pika-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a642655bce2aab2ef074e848d7098fcbdb0225f5b7c425054d8e4edde93285d1 |
|
MD5 | ee23304cf6423a7a8535837a832bd5c1 |
|
BLAKE2b-256 | 0c8653b4dfee8d0d3bace187eb29e89d6f2d69b37dcab4fb0d326e7ef884baee |