Skip to main content

nsq client library

Project description


nsq client


import orjson
import asyncio
from datetime import datetime, timezone
from loguru import logger

from aonsq import NSQMessage, NSQ

async def msg_handler(msg: NSQMessage) -> bool:
    logger.debug(f"msg: {}")
    return True

async def test():
    mq = NSQ(host="", port=4071)
    await mq.connect()
    await mq.sub("demo", "test", msg_handler)

    while True:
        for j in range(1000):
            await"demo", orjson.dumps({"id": j, "ts_created":}))

        await asyncio.sleep(1)

except KeyboardInterrupt:

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

aonsq-0.1.9.tar.gz (9.0 kB view hashes)

Uploaded source

Built Distribution

aonsq-0.1.9-py3-none-any.whl (10.0 kB view hashes)

Uploaded py3

Supported by

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