NATS App is wrapper client on NATS Connection
Project description
NATS App
NATS App is wrapper application on NATS Connection
Create NATS Application
NATS_URL = "nats://localhost:4222"
nc = NATSApp(NATS_URL)
await nc.connect()
Add RPC Handler
@nc.push_subscribe("app.test.echo", queue="worker")
async def rpc_func_echo(msg: Any) -> str:
return f"Response with Msg.data: {msg.data}"
Call RPC
res = await nc.request("app.test.echo", {"args": ["test"]})
print(res)
JetStream push subscription
@nc.js_push_subscribe("app.test.js.subs", queue="worker")
async def handler(msg: Msg):
print(msg.data)
await msg.ack()
JetStream pull subscription
@nc.js_pull_subscribe("app.subject.js.subs", batch=1)
async def handler(msgs: list[Msg]):
for m in msgs:
print(m)
await m.ack()
JetStream publish
await nc.js.publish("app.subject.js.subs", b"TEST123")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
nats_app-0.1.2.tar.gz
(13.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
nats_app-0.1.2-py3-none-any.whl
(17.9 kB
view details)
File details
Details for the file nats_app-0.1.2.tar.gz.
File metadata
- Download URL: nats_app-0.1.2.tar.gz
- Upload date:
- Size: 13.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.12.8 Linux/6.5.0-1025-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
658b9e3e4c7d98d6dbf7ebd64f3693e925ebf0bf6397de7d8c17bf3f5d96de23
|
|
| MD5 |
2c2e30c0160863989ef645db18672a4f
|
|
| BLAKE2b-256 |
0a26e7b09cf27f893975f57899e90c1c2f151fbf47c76c5b7f4be34a2fc43d04
|
File details
Details for the file nats_app-0.1.2-py3-none-any.whl.
File metadata
- Download URL: nats_app-0.1.2-py3-none-any.whl
- Upload date:
- Size: 17.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.12.8 Linux/6.5.0-1025-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
016f4d07f6f336f88c480c8c9cda5d2fe617ff91e36a74ccd4f6f26b279b6e6a
|
|
| MD5 |
a406e00661b279d598ae981c06fa7884
|
|
| BLAKE2b-256 |
a777d31925d79745204d02a65eaae3416e19021984abe213719ba38f171ccbe7
|