All Projects → davidMcneil → rants

davidMcneil / rants

Licence: Apache-2.0, MIT licenses found Licenses found Apache-2.0 LICENSE-APACHE MIT LICENSE-MIT
An async NATS client library for the Rust programming language.

Programming Languages

rust
11053 projects

Labels

Projects that are alternatives of or similar to rants

Nats Queue Worker
Queue-worker for OpenFaaS with NATS Streaming
Stars: ✭ 98 (+22.5%)
Mutual labels:  nats
Unifrost
Making it easier to push pubsub events directly to the browser.
Stars: ✭ 166 (+107.5%)
Mutual labels:  nats
Nats Top
A top-like tool for monitoring NATS servers.
Stars: ✭ 202 (+152.5%)
Mutual labels:  nats
Golang Examples
Stars: ✭ 114 (+42.5%)
Mutual labels:  nats
Stan.net
The official NATS .NET C# Streaming Client
Stars: ✭ 131 (+63.75%)
Mutual labels:  nats
Liftbridge
Lightweight, fault-tolerant message streams.
Stars: ✭ 2,175 (+2618.75%)
Mutual labels:  nats
Gg
监听mysql的binlog,发送消息到nats或rabbitmq
Stars: ✭ 67 (-16.25%)
Mutual labels:  nats
golang-example-app
Example application
Stars: ✭ 138 (+72.5%)
Mutual labels:  nats
Go Micro Boilerplate
The boilerplate of the GoLang application with a clear microservices architecture.
Stars: ✭ 147 (+83.75%)
Mutual labels:  nats
Voik
♒︎ [WIP] An experimental ~distributed~ commit-log
Stars: ✭ 200 (+150%)
Mutual labels:  nats
Aither
An example microservice system in Node.js using Hemera and best of today.
Stars: ✭ 116 (+45%)
Mutual labels:  nats
Websocket Nats
An in-browser websocket client for NATS, a lightweight, high-performance cloud native messaging system
Stars: ✭ 125 (+56.25%)
Mutual labels:  nats
Prometheus Nats Exporter
A Prometheus exporter for NATS metrics
Stars: ✭ 179 (+123.75%)
Mutual labels:  nats
Rust Nats
A simple NATS client library for Rust
Stars: ✭ 100 (+25%)
Mutual labels:  nats
Phpnats
A PHP client for the NATSio cloud messaging system.
Stars: ✭ 209 (+161.25%)
Mutual labels:  nats
Nats.ex
Elixir client for NATS, the cloud native messaging system. https://nats.io
Stars: ✭ 97 (+21.25%)
Mutual labels:  nats
Kubernetes Nats Cluster
NATS cluster on top of Kubernetes made easy.
Stars: ✭ 168 (+110%)
Mutual labels:  nats
nats-surveyor
NATS Monitoring, Simplified.
Stars: ✭ 150 (+87.5%)
Mutual labels:  nats
Watermill
Building event-driven applications the easy way in Go.
Stars: ✭ 3,504 (+4280%)
Mutual labels:  nats
Openmessaging Benchmark
OpenMessaging Benchmark Framework
Stars: ✭ 184 (+130%)
Mutual labels:  nats

Rants

build status crates.io docs License License

An async NATS client library for the Rust programming language.

The client aims to be an ergonomic, yet thin, wrapper over the NATS client protocol. The easiest way to learn to use the client is by reading the NATS client protocol documentation. The main entry point into the library's API is the Client struct.

TLS support can be powered by the native-tls crate enabled with the native-tls feature, or TLS support can be powered by the rustls crate enabled with the rustls-tls feature.

Example

use futures::stream::StreamExt;
use rants::Client;

#[tokio::main]
async fn main() {
   // A NATS server must be running on `127.0.0.1:4222`
   let address = "127.0.0.1:4222".parse().unwrap();
   let client = Client::new(vec![address]);

   // Configure the client to receive messages even if it sent the message
   client.connect_mut().await.echo(true);

   // Connect to the server
   client.connect().await;

   // Create a new subject called "test"
   let subject = "test".parse().unwrap();

   // Subscribe to the "test" subject
   let (_, mut subscription) = client.subscribe(&subject, 1024).await.unwrap();

   // Publish a message to the "test" subject
   client
       .publish(&subject, b"This is a message!")
       .await
       .unwrap();

   // Read a message from the subscription
   let message = subscription.next().await.unwrap();
   let message = String::from_utf8(message.into_payload()).unwrap();
   println!("Received '{}'", message);

   // Disconnect from the server
   client.disconnect().await;
}

Development

The integration test suite requires the NATS_PATH environment variable point to the NATS server executable:

> cargo test

The env_logger crate is used in integration tests. To enable it and run a single test run:

> RUST_LOG=rants=trace cargo test ping_pong

Alternatives

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].