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.6.0.tar.gz
(20.7 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.6.0-py3-none-any.whl
(26.9 kB
view details)
File details
Details for the file nats_app-0.6.0.tar.gz.
File metadata
- Download URL: nats_app-0.6.0.tar.gz
- Upload date:
- Size: 20.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.12.11 Linux/6.11.0-1015-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb8363eaf9603056b4f26f2efabd1ec0d2e14d799e94fa06953ad1417f896491
|
|
| MD5 |
ee23c7986a9bf74ba3af29f72cc20d54
|
|
| BLAKE2b-256 |
49e773b4a4ce676cc1379f6175056049cb08c7a01b0abd4e4c73ad3988a6bb62
|
File details
Details for the file nats_app-0.6.0-py3-none-any.whl.
File metadata
- Download URL: nats_app-0.6.0-py3-none-any.whl
- Upload date:
- Size: 26.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.12.11 Linux/6.11.0-1015-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d9f077b99c9b752a504df5967324f000ceae812fd4c2a18ec0f0268722a8233
|
|
| MD5 |
0341a99345ed500988ad3744612314da
|
|
| BLAKE2b-256 |
b30ba510321a582077858140d536c33d8e0d4bdaf3694ac68d2fe995142f19f3
|