Skip to content

nats-io/nats.rs

main
Switch branches/tags
Code

A Rust client for the NATS messaging system.

Motivation

Rust may be one the most interesting new languages the NATS ecosystem has seen. We believe this client will have a large impact on NATS, distributed systems, and embedded and IoT environments. With Rust we wanted to be as idiomatic as we could be and lean into the strengths of the language. We moved many things that would have been runtime checks and errors to the compiler, most notably options on connections, and having subscriptions generate multiple styles of iterators, since iterators are a first class citizen in Rust. We also wanted to be aligned with the NATS philosophy of simple, secure, and fast!

Clients

There are two clients available in two separate crates:

nats

License Apache 2 Crates.io Documentation Build Status

Legacy synchronous client that supports:

  • Core NATS
  • JetStream API
  • JetStream Management API
  • Key Value Storage
  • Object Store

async-nats

License Apache 2 Crates.io Documentation Build Status

New bleeding edge experimental async Tokio-based NATS client.

Currently supports:

  • Core NATS
  • JetStream Pull Consumers API
  • JetStream Management API

And should soon catch up with in terms of feature parity with synchronous client. When it reaches feature parity with nats crate, synchronous wrapper over async-nats will replace current nats codebase.

Any feedback related to this client is welcomed.

Documentation

Please refer each crate docs for API reference and examples.

Feedback

We encourage all folks in the NATS and Rust ecosystems to help us improve this library. Please open issues, submit PRs, etc. We're available in the rust channel on the NATS slack as well!