Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pooled-pika, version 0.1.6
Filename, size File type Python version Upload date Hashes
Filename, size pooled-pika-0.1.6.tar.gz (3.3 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page