Skip to content

ruststream-nats

ruststream-nats is the NATS broker for the RustStream messaging framework. It covers Core NATS subjects and JetStream durable consumers, implements request/reply over native NATS, and ships an in-process test broker under its testing feature.

Handlers, routers, codecs, and middleware come from the framework; this crate supplies the transport, and nothing broker-specific leaks back into the framework.

ruststream = { version = "0.4", features = ["macros", "json"] }
ruststream-nats = "0.4"
serde = { version = "1", features = ["derive"] }
#[ruststream::app]
fn app() -> RustStream {
    RustStream::new(AppInfo::new("orders", "0.1.0")).with_broker(
        NatsBroker::new("nats://localhost:4222"),
        |b| {
            b.include(handle);
        },
    )
}

Where to go next

  • NATS guide - Core subscriptions, JetStream, request/reply, and testing.
  • RustStream docs - the framework itself: subscribers, routing, codecs, middleware, the CLI.
  • API reference - the crate's rustdoc on docs.rs.

How this site relates to the RustStream docs

This site documents the NATS broker only. Framework concepts that apply to every broker (writing subscribers, publishing, routing, codecs, middleware, observability, the CLI) live in the RustStream documentation. The pages here cover what is specific to NATS and link back to the framework docs where the two meet.