diff --git a/README.md b/README.md index 411a146..f089029 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# NSQ Rust client [![Build Status](https://travis-ci.com/alex179ohm/nsq-client-rs.svg?branch=master)](https://travis-ci.com/alex179ohm/nsq-client-rs) [![Build status](https://ci.appveyor.com/api/projects/status/ov5ryj2r4iy2v7rp/branch/master?svg=true)](https://ci.appveyor.com/project/alex179ohm/nsq-client-rs/branch/master) +# NSQ client written in rust [![Build Status](https://travis-ci.com/alex179ohm/nsq-client-rs.svg?branch=master)](https://travis-ci.com/alex179ohm/nsq-client-rs) [![Build status](https://ci.appveyor.com/api/projects/status/ov5ryj2r4iy2v7rp/branch/master?svg=true)](https://ci.appveyor.com/project/alex179ohm/nsq-client-rs/branch/master) Sponsored by --- A [Actix](https://actix.rs/) based client implementation for the [NSQ](https://nsq.io) realtime message processing system. @@ -69,14 +69,10 @@ $ cargo run [![asciicast](https://asciinema.org/a/8dZ5QgjN3WCwDhgU8mAX9BMsR.svg)](https://asciinema.org/a/8dZ5QgjN3WCwDhgU8mAX9BMsR) -### Current features and work in progress -- [X] PUB -- [X] SUB +### ToDo - [ ] Discovery -- [X] Backoff - [ ] TLS - [ ] Snappy -- [X] Auth - [ ] First-ready-first-served readers routing algorithm. ## License diff --git a/src/lib.rs b/src/lib.rs index ffb9a24..ecc925c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -21,6 +21,41 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. +//! Nsq-client is a actix based implementation of nsq protocol. +//! +//! This crate is intended as a swiss-knife base implementation for more +//! complex nsq client applications, it supports even single or multiple connections, single or +//! multiple async readers. +//! +//! Due the actors's actix model, readers and connections are distinct entities witch communicate +//! each other throught messages, so one reader could receive messages from multiple connections and multiple +//! connections could easily share multiple readers. +//! +//! +//! # Example +//! ``` +//! struct MyReader{ +//! conn: Arc>, +//! }; +//! +//! impl Actor for MyReader { +//! type Context = Context; +//! fn started(&mut self, _: &mut Self::Context) { +//! self.subscribe::(ctx, self.conn.clone()); +//! } +//! } +//! +//! impl Handler for MyReader { +//! type Result = (); +//! fn handle(&mut self, msg: Msg, ctx: &mut Self::Context) { +//! let conn = msg.conn.clone(); +//! let msg = msg.msg; +//! info!("MyReader received: {:?}", msg); +//! conn.do_send(Fin(msg.id)); +//! } +//! } +//! ``` + #![feature(try_from, associated_type_defaults)] extern crate futures; extern crate tokio_io; @@ -34,7 +69,6 @@ extern crate serde_json; extern crate actix; extern crate backoff; extern crate log; -//extern crate snap; extern crate byteorder; extern crate fnv; @@ -49,13 +83,11 @@ mod msgs; mod producer; mod conn; mod subscribe; -//mod consumer; pub use commands::{fin, req, touch}; pub use subscribe::{Subscribe}; pub use config::Config; pub use producer::{Producer}; pub use conn::{Connection}; -pub use codec::{NsqCodec, Cmd}; pub use error::Error; -pub use msgs::{Fin, Msg, Reqeue, Touch, Conn, Pub, NsqMsg, AddHandler, Ready, InFlight}; +pub use msgs::{Fin, Msg, Reqeue, Touch, Conn, Pub, InFlight};