Expand description
Production NATS JetStream + KV implementations of klieo-core’s
bus traits (klieo_core::Pubsub, klieo_core::RequestReply,
klieo_core::KvStore, klieo_core::JobQueue).
This is the differentiator vs other Rust agent frameworks: durable, leased, dedup’d, DLQ-routed inter-agent communication. Work does not get stuck.
§Quickstart
// After Plan #9 Task 7 lands:
// use klieo_bus_nats::{NatsBus, NatsBusConfig};
// let bus = NatsBus::connect(NatsBusConfig::default()).await?;§Limitations
- JetStream / KV must be enabled on the server. Run
nats-server -js. - First-call latency. Streams + KV buckets are created idempotently on first publish/subscribe; that adds one round-trip per (subject pattern, bucket) tuple. Subsequent calls are cached.
- Pull-consumer batch size = 1.
JobQueue::claimpulls one message at a time; this matches the trait’s “claim next” shape. For higher throughput, run multiple workers.
Structs§
- Nats
Auth - Credentials and TLS toggle for a NATS connection.
- NatsBus
- Wired-together production bus. Build once, share across agents. The
Arc<dyn ...>shape matchesklieo_bus_memory::MemoryBusexactly, so callers can swap impls in config. - Nats
BusConfig - Tunables for
crate::NatsBus. - Nats
JobQueue - JetStream-backed implementation of
JobQueue. - NatsKv
- JetStream KV-backed implementation of
KvStore. - Nats
Pubsub - JetStream-backed implementation of
Pubsub. - Nats
Request Reply RequestReplyimpl. Uses NATS core (not JetStream) because request/reply is inherently ephemeral — durable replies make no sense.