Tokio NSQ

GitHub Actions

A rust NSQ client built on Tokio. Tokio NSQ aims to be a feature complete NSQ client implementation.

Versioning

This project follows strict semantic versioning. While pre 1.0.0 breaking changes have only a minor version bump.

Basic consumer example

```rust let topic = NSQTopic::new("names").unwrap(); let channel = NSQChannel::new("first").unwrap();

let mut addresses = HashSet::new(); addresses.insert("http://127.0.0.1:4161".to_string());

let mut consumer = NSQConsumerConfig::new(topic, channel) .setmaxinflight(15) .setsources( NSQConsumerConfigSources::Lookup(NSQConsumerLookupConfig { poll_interval: std::time::Duration::new(5, 0), addresses: addresses, } )) .build();

let mut message = consumer.consume_filtered().await.unwrap();

let messagebodystr = std::str::fromutf8(&message.body).unwrap(); println!("message body = {}", messagebody_str);

message.finish(); ```

Basic producer example

```rust let topic = NSQTopic::new("names").unwrap();

let mut producer = NSQProducerConfig::new("127.0.0.1:4150").build();

println!("waiting on status"); let status = producer.consume().await; println!("status {:?}", status);

producer.publish(&topic, "alice1".tostring().asbytes().to_vec()); ```

Features