Skip to main content

Asyncio Disque client

Project description

Python3.5 & Asyncio client for Disque message broker.

Installation

aiodisque requires a running disque server.

python -m pip install -e .

Getting started

Usage:

from aiodisque import Disque
client = Disque()
job_id = await client.sendjob('queue', 'body')

client accepts a tcp or unix address:

client = Disque(address='127.0.0.1:7711')
client = Disque(address=('127.0.0.1', 7711))
client = Disque(address='/path/to/socket')

API Reference

The official Disque command documentation does a great job of explaining each command in detail. There are a few exceptions:

  • each method are lowered
  • async keywords are replaced by asynchronous

In addition to the changes above, it implements some async sugar:

  • Fancy async iterators:

    async for jobs in client.client.getjob_iter('q', nohang=True):
        print(jobs)
    
    async for queue in client.qscan_iter(count=128):
        print(queue)
    
    async for job in client.jscan_iter(count=128):
        print(job)
    
  • There is also an experimentaton that try to mimic an asyncio.Queue:

    from aiodisque.queue import Queue
    queue = JobsQueue('queue', client)
    job_id = await queue.put('job')
    job = await queue.get()
    assert job.id == job_id
    
  • client can reconnect automatically when a connection lost:

    from aiodisque import Disque
    client = Disque(auto_reconnect=True)
    await client.hello()
    # ... connection has been lost here...
    await client.hello()  # this not fails
    

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

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

Files for aiodisque, version 0.1
Filename, size File type Python version Upload date Hashes
Filename, size aiodisque-0.1-py2.py3-none-any.whl (15.1 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size aiodisque-0.1.tar.gz (27.2 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