Skip to main content

nsq client library

Project description

aonsq

nsq client

Example

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: {msg.id}")
    return True


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

    while True:
        for j in range(1000):
            await mq.pub("demo", orjson.dumps({"id": j, "ts_created": datetime.now(timezone.utc)}))

        await asyncio.sleep(1)

try:
    asyncio.get_event_loop().run_until_complete(test())
except KeyboardInterrupt:
    pass

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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

Details for the file aonsq-0.1.9.tar.gz.

File metadata

  • Download URL: aonsq-0.1.9.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.6

File hashes

Hashes for aonsq-0.1.9.tar.gz
Algorithm Hash digest
SHA256 1b49f9291c2833e1968a42e0666877b9b60b61d4a10210840145ec169ed62275
MD5 8cf8704081a5b8810eeb774490f5f330
BLAKE2b-256 f77c5de66b8042c54f8d22764ab3c16daeb0ae1e038df735ad66c66d8ad87bb4

See more details on using hashes here.

File details

Details for the file aonsq-0.1.9-py3-none-any.whl.

File metadata

  • Download URL: aonsq-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.6

File hashes

Hashes for aonsq-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 de1169d32cf46eda673ea27750f1064c5c0defa2610915b5f097d762e077ba7a
MD5 60816be8c8ac23e24419d70540db6e39
BLAKE2b-256 785df28808213a364d3d1141c8bd15f8bf858849855ba52df74d40ef051791d1

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