resonate-nats
NATS connector for Resonate.
NatsConnection is both a Network (request/reply to the Resonate server)
and a Source (subscriptions carrying execute / unblock messages), so it
can serve as a Resonate client's only connection — passed as network, it
doubles as the source.
import nats
from resonate.resonate import Resonate
from resonate_nats import NatsConnection
conn = NatsConnection(await nats.connect("nats://localhost:4222"), group="workers")
resonate = Resonate(network=conn, group="workers")
The NATS client's lifecycle stays yours: pass one already connected, and
stop() tears down only this connection's subscriptions.
Name the same group on both. The connection uses it to build the subjects it
subscribes to; Resonate uses it as the routing target a run/rpc defaults
to. Told two different groups, a worker would dispatch its own work to a group
it is not listening on.
Addressing
Addresses are NATS subjects wearing a nats:// scheme, which the server's
url.Parse hands straight back:
| Subject | Advertised as | |
|---|---|---|
| unicast | resonate.recv.{group}.{pid} |
nats://resonate.recv.workers.7f3a |
| anycast | resonate.recv.{group} |
queue-subscribed on {group}, so exactly one member gets each message |
Requests are published to {api_prefix}.{base64url(origin)} — the routing
origin the SDK hands to send. The request body is never parsed here: it is
bytes to be moved.
Errors
Transport failures surface as ConnectorError, so application code can handle
any transport giving up without importing this package or knowing which
connector is in use:
from resonate_base import ConnectorError
try:
await resonate.run("greet", ...)
except ConnectorError as exc:
...
Install
pip install resonate-nats
Deliberately not an extra of resonate-sdk: an extra would put this package in
the SDK's published dependency metadata, pointing the arrow back down the
stack. resonate-nats depends only on
resonate-base and nats-py, never
on resonate-sdk.
Release files for resonate-nats 0.8.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| resonate_nats-0.8.0.tar.gz | 5.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| resonate_nats-0.8.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.0 kB
Release files / resonate_nats-0.8.0.tar.gz
| Download URL | resonate_nats-0.8.0.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f7df225ccb7296bbfce5261accf5d49a8da6debe4d87ee1c0e319d2abce69689
|
|
BLAKE2b-256 checksum How to use checksums |
82c489429391f03998c0cfff51e4d424303fc6bcb4fb15028f86ea48a8bdc3fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / resonate_nats-0.8.0-py3-none-any.whl
| Download URL | resonate_nats-0.8.0-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
63efd5db3fb72ac8046d4e60352e12f47d9ac3dcbe86f52af516b3feaa6e609a
|
|
BLAKE2b-256 checksum How to use checksums |
b4517a8ae9251ad74f2cfd8d1e5515e1e6a5043a879bc047f01daf1e44be0a11
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|