Metadata-Version: 2.1
Name: aonsq
Version: 0.0.7
Summary: an other async nsq client library
Home-page: https://github.com/SCys/aonsq
Author: SCys
Author-email: me@iscys.com
License: UNKNOWN
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Topic :: Software Development :: Libraries
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Requires-Dist: aiohttp (>=3.5.4)
Requires-Dist: loguru (>=0.3.2)
Requires-Dist: orjson (>=2.0.7)

# aonsq

an other async nsq client library

## Example

```python
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
```

