Skip to main content

Pools for pikas.

Project description

https://travis-ci.org/bninja/pika-pool.png https://coveralls.io/repos/bninja/pika-pool/badge.png?branch=master

Pika connection pooling inspired by:

Typically you’ll go with local shovel(s), krazee-eyez kombu, etc. but this works too.

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,
         )
     )

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.1.tar.gz (4.4 kB view details)

Uploaded Source

File details

Details for the file pika-pool-0.1.1.tar.gz.

File metadata

  • Download URL: pika-pool-0.1.1.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pika-pool-0.1.1.tar.gz
Algorithm Hash digest
SHA256 925270d701b85ff7be3094051eb4bd34a10b6d990ccf5f69e07b44d6ff655555
MD5 28098544fea92bf493c575832a90bf0a
BLAKE2b-256 909b10ea056d093cabc78f335f80f2dd5f4245370d7675b2aa9292222c299233

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page