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.2.7.tar.gz
(16.6 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.2.7-py3-none-any.whl
(21.5 kB
view details)
File details
Details for the file nats_app-0.2.7.tar.gz.
File metadata
- Download URL: nats_app-0.2.7.tar.gz
- Upload date:
- Size: 16.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.2 CPython/3.12.10 Linux/6.11.0-1012-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4820470155aabd206b6f56515464045749b5f568372fd14aa7cfdb8a2eec5b9
|
|
| MD5 |
c558942f3246b8d2e8bd3065fcebaf88
|
|
| BLAKE2b-256 |
513b8d3e8ffedcee25dec2f1fc588e0e4218268929d961018c7296f94ad84b0b
|
File details
Details for the file nats_app-0.2.7-py3-none-any.whl.
File metadata
- Download URL: nats_app-0.2.7-py3-none-any.whl
- Upload date:
- Size: 21.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.2 CPython/3.12.10 Linux/6.11.0-1012-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac452f54ea04abdfa9f64d3f83f1a9b706c019f7726d2bbfae7f4405cc254cea
|
|
| MD5 |
ddc390218fb7803f35323093b69cc985
|
|
| BLAKE2b-256 |
c345dcda6cb8dd859f445eeef37021dd95d95fbb950c7f64dc059c5b25596934
|