Ratsio
Ratsio is a Rust client library for NATS messaging system and NATS Event Streaming.
Inspired by nitox and rust-nats but my project needed NATS streaming, so I couldn't use any of those 2. If this project is useful to you, feel free to contribute or suggest features. at the moment it's just the features I need.
Add the following to your Cargo.toml.
= "^0.2"
ratsio
Rust -stable, -beta and -nightly are supported.
Features:
- Nats messaging queue. Publish, Subcribe and Request.
- Nats cluster support, auto reconnect and dynamic cluster hosts update.
- Async from the ground up, using tokio and futures.
- TLS mode
- Authentication
- NATS Streaming Server
Usage
Subscribing and Publishing to a NATS subject: see tests/nats_client_test.rs
let mut runtime = new.unwrap;
let options = builder
.cluster_uris
.build
.unwrap;
let fut = from_options
.and_then
.and_then;
let = channel;
runtime.spawn;
let connection_result = rx.wait.expect;
let _ = runtime.shutdown_now.wait;
info!;
assert!;
let msg = connection_result.unwrap;
assert_eq!;
Subscribing and Publishing to a NATS streaming subject: see tests/stan_client_test.rs
let mut runtime = new.unwrap;
let nats_options = builder
.cluster_uris
.build
.unwrap;
let stan_options = builder
.nats_options
.cluster_id
.client_id.build
.unwrap;
let = unbounded;
let = channel;
let subject: String = "test.subject".into;
let subject1 = subject.clone;
let subject2 = subject.clone;
let program = from_options
.and_then
.and_then
.map_err
.and_then.map_err;
runtime.spawn;
let stan_client = stan_client_rx.wait.expect;
match result_rx.wait.next.expect ;
let = channel;
runtime.spawn;
let _ = close_rx.wait.expect;
let _ = runtime.shutdown_now.wait;
Important Changes
Version 0.2
Users no longer need to use ratsio::ops::Connect struct when configuring a connection. Options are now availabble on NatsClientOptions, username, password, tls_required, auth_token, etc
For example
let nats_options = builder
.username
.password
.cluster_uris
.build
.unwrap;
Internal nuid fork from nuid upgraded to use rand version ^0.6
Contact
For bug reports, patches, feature requests or other messages, please send a mail to michael@zulzi.com
License
This project is licensed under the MIT License.