Skip to main content

nats-extra

Core NATS extensions. The first utility is request-many, a streaming request/reply and scatter-gather pattern matching nats-extra in orbit.rs.

Install

pip install nats-extra

Usage

import nats.extra
from nats.client import connect

nc = await connect("nats://localhost:4222")

responses = await nats.extra.request_many(
    nc,
    "services.ping",
    b"ping",
    stall_wait=0.25,  # stop after 250 ms without another response
)
async for response in responses:
    print(response.data)

print(responses.termination_reason)

Request streams can terminate on max_messages, max_wait, stall_wait, a sentinel predicate, a no-responders status, or subscription closure. The reason is available as responses.termination_reason.

The orbit.rs-style builder is also available:

responses = await (
    nats.extra.RequestMany(nc)
    .max_messages(10)
    .stall_wait(0.25)
    .sentinel(lambda message: message.data == b"done")
    .send("services.work", b"start")
)

Natural termination unsubscribes automatically. When abandoning a response stream early, call await responses.aclose() or use it as an async context manager.

License

Apache 2.0

Metadata

Release files for nats-extra 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nats-extra 0.1.0
File Size Uploaded
nats_extra-0.1.0.tar.gz 3.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nats-extra 0.1.0
File Interpreter ABI Platform
nats_extra-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.6 kB

Release files / nats_extra-0.1.0.tar.gz

Download URL nats_extra-0.1.0.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
8fb0fbbf35e187dccd088a62780700955bbb5712fae385f2bd39ccd6189a08c7
BLAKE2b-256 checksum
How to use checksums
a38493c0244bd341f07938dc37df7f72dd44804dbba5493e97b3eaa80f681b80
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / nats_extra-0.1.0-py3-none-any.whl

Download URL nats_extra-0.1.0-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fa03a862667a036d2deaf62cb1607e2a1ca57faaa879ee74145812b27f02be14
BLAKE2b-256 checksum
How to use checksums
5d908a7debff3f5d6044de4e20d585c099bb9b50b83e3b1392e8bf2a52dcef88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page