Crates.io | nitox |
lib.rs | nitox |
version | 0.1.9 |
source | src |
created_at | 2018-09-30 00:33:45.955002 |
updated_at | 2018-11-13 18:10:45.275038 |
description | Nitox is a `tokio`-based client for NATS. |
homepage | https://github.com/YellowInnovation/nitox |
repository | https://github.com/YellowInnovation/nitox |
max_upload_size | |
id | 87208 |
size | 91,950 |
Nitox is a tokio
-based client for NATS. We wrote it because the existing library is sync and does not fit our needs.
A lot of features are currently missing, so feel free to contribute and help us building the best Async NATS client ever!
Missing features:
nom
- We're not sure we can handle very weird clients; we're fine talking to official ones right nowprost
since we already have the async architecture going onThere's a small extra in the tests/
folder, some of our integration tests rely on a custom NATS server implemented with tokio
that only implements a subset of the protocol to fit our needs for the integration testing.
Here: http://docs.rs/nitox
[dependencies]
nitox = "0.1"
extern crate nitox;
extern crate futures;
use futures::{prelude::*, future};
use nitox::{NatsClient, NatsClientOptions, NatsError, commands::*};
fn connect_to_nats() -> impl Future<Item = NatsClient, Error = NatsError> {
// Defaults as recommended per-spec, but you can customize them
let connect_cmd = ConnectCommand::builder().build().unwrap();
let options = NatsClientOptions::builder()
.connect_command(connect_cmd)
.cluster_uri("127.0.0.1:4222")
.build()
.unwrap();
NatsClient::from_options(options)
.and_then(|client| {
// Makes the client send the CONNECT command to the server, but it's usable as-is if needed
client.connect()
})
.and_then(|client| {
// Client has sent its CONNECT command and is ready for usage
future::ok(client)
})
}
Licensed under either of these:
Standing for Nitric Oxide, an important chemical involved in communication between neurons; It's highly related to the acronym behind NATS, and you should ask the team behind it for the meaning! (or look in the git history of gnatsd
's repo)
NATS Server is a simple, high performance open source messaging system for cloud native applications, IoT messaging, and microservices architectures.
More details at NATS.io
Yellow Innovation is the innovation laboratory of the French postal service: La Poste.
We create innovative user experiences and journeys through services with a focus on IoT lately.