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.0.tar.gz
(14.1 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.0-py3-none-any.whl
(17.8 kB
view details)
File details
Details for the file nats_app-0.1.0.tar.gz.
File metadata
- Download URL: nats_app-0.1.0.tar.gz
- Upload date:
- Size: 14.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.13.1 Darwin/24.2.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2908aef453c3c760981afe12676d68cfbc8240d42c3f2ac82b2aef7bf883aa14
|
|
| MD5 |
c91b3e206317ecd2ed054b405308bc12
|
|
| BLAKE2b-256 |
c0d413f0b75520995728d81d087298befcf3b58e71798e76c8432c61ede7557c
|
File details
Details for the file nats_app-0.1.0-py3-none-any.whl.
File metadata
- Download URL: nats_app-0.1.0-py3-none-any.whl
- Upload date:
- Size: 17.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.13.1 Darwin/24.2.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be1680ede909e2a1547eed9e9b04dc5679a53576a0a7c55220e96a90f6e3fa67
|
|
| MD5 |
75bb7fda2490075b84b76573db04728c
|
|
| BLAKE2b-256 |
769666f5fcf53ce59ce21d376993b360e1f0cf5d89d8ee7fb8f81c9839522e2b
|