[−][src]Crate tokio_nsq
A Rust NSQ client built on Tokio. Tokio NSQ aims to be a feature complete NSQ client implementation.
A basic producer example:
use tokio_nsq::*; let topic = NSQTopic::new("names").unwrap(); let channel = NSQChannel::new("first").unwrap(); let mut addresses = std::collections::HashSet::new(); addresses.insert("http://127.0.0.1:4161".to_string()); let mut consumer = NSQConsumerConfig::new(topic, channel) .set_max_in_flight(15) .set_sources( NSQConsumerConfigSources::Lookup( NSQConsumerLookupConfig::new().set_addresses(addresses) ) ) .build(); let mut message = consumer.consume_filtered().await.unwrap(); let message_body_str = std::str::from_utf8(&message.body).unwrap(); println!("message body = {}", message_body_str); message.finish();
Structs
MessageFromNSQ | An NSQ message. If this message is dropped with being finished and the respective NSQ daemon connection still exists the message will automatically by requeued. |
NSQChannel | A smart constructor validating an NSQ channel name |
NSQConfigShared | Configuration options shared by both produces and consumers |
NSQConfigSharedTLS | NSQD TLS encryption options |
NSQConsumer | An NSQD consumer corresponding to multiple NSQD instances |
NSQConsumerConfig | Configuration object for an NSQD consumer |
NSQConsumerLookupConfig | Configuration object for NSQLookup nodes |
NSQProducer | An NSQD producer corresponding to a single instance |
NSQProducerConfig | Configuration object for an NSQ consumer |
NSQTopic | A smart constructor validating an NSQ topic name |
Enums
NSQConfigSharedCompression | NSQD TCP compression options |
NSQConsumerConfigSources | The strategy a consumer should use to connect to NSQD instances |
NSQEvent | An event from an NSQ connection. Includes connection status updates, errors, and actually NSQ messages. |