Skip to content

jettify/aiobeanstalk

Repository files navigation

aiobeanstalk

image

aiobeanstalk is a library for accessing beanstalk message queue from the asyncio (PEP-3156/tulip) framework. Basicly code ported from awesome pybeanstalk project and their twisted adapter.

Library is not stable and there are some tests .

Example

Producer

import asyncio
import aiobeanstalk


def main():
    bs = yield from aiobeanstalk.connect(host='localhost', port=11300)

    data = yield from bs.put('{"nice":"job"}')
    print(data)

if __name__ == '__main__':
    loop = asyncio.get_event_loop()
    loop.run_until_complete(main())
    loop.run_forever()

Consumer

import asyncio
import aiobeanstalk


def main():
    bs = yield from aiobeanstalk.connect(host='localhost', port=11300)
    # wait for job from *default* tube
    res_data = yield from bs.reserve()
    print(res_data)
    status, data = yield from bs.delete(res_data['jid'])
    print(data)

if __name__ == '__main__':
    loop = asyncio.get_event_loop()
    loop.run_until_complete(main())
    loop.run_forever()

Other Projects

I have learned a lot from this projects, authors have done great work, give them a try first.

About

Beanstalkd message queue client for asyncio.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages