Skip to content

pedrokiefer/aiostomp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

3449dcb · Nov 25, 2022
Nov 25, 2022
Nov 25, 2022
Apr 25, 2018
Jul 9, 2019
Nov 24, 2022
Nov 25, 2022
Jan 16, 2018
Jan 16, 2018
Jan 16, 2018
May 29, 2018
Jan 16, 2018
Jan 16, 2018
Nov 25, 2022
Nov 24, 2022
Nov 25, 2022
Nov 25, 2022
Nov 25, 2022
Jan 16, 2018

Repository files navigation

Build Status Coverage Status PyPI version

Aiostomp

Simple asyncio stomp 1.1 client for python 3.6.

Heavely inspired on torstomp.

Install

with pip:

pip install aiostomp

Usage

import sys
import logging
import asyncio

from aiostomp import AioStomp

logging.basicConfig(
    format="%(asctime)s - %(filename)s:%(lineno)d - "
    "%(levelname)s - %(message)s",
    level='DEBUG')


async def run():
    client = AioStomp('localhost', 61613, error_handler=report_error)
    client.subscribe('/queue/channel', handler=on_message)

    await client.connect()

    client.send('/queue/channel', body=u'Thanks', headers={})


async def on_message(frame, message):
    print('on_message:', message)
    return True


async def report_error(error):
    print('report_error:', error)


def main(args):
    loop = asyncio.get_event_loop()
    loop.run_until_complete(run())
    loop.run_forever()


if __name__ == '__main__':
    main(sys.argv)

Development

With empty virtualenv for this project, run this command:

make setup

and run all tests =)

make test

Contributing

Fork, patch, test, and send a pull request.