Skip to content

Commit

Permalink
Add documentation and update README
Browse files Browse the repository at this point in the history
  • Loading branch information
alex179ohm committed Feb 17, 2019
1 parent 5bdf181 commit bfeb9e5
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 10 deletions.
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -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 href="https://tngrm.io"><img src="https://tngrm.io/static/img/tngrm_black.svg" width="100"></a>
---
A [Actix](https://actix.rs/) based client implementation for the [NSQ](https://nsq.io) realtime message processing system.
Expand Down Expand Up @@ -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
Expand Down
40 changes: 36 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Addr<Connection>>,
//! };
//!
//! impl Actor for MyReader {
//! type Context = Context<Self>;
//! fn started(&mut self, _: &mut Self::Context) {
//! self.subscribe::<Msg>(ctx, self.conn.clone());
//! }
//! }
//!
//! impl Handler<Msg> 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;
Expand All @@ -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;

Expand All @@ -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};

0 comments on commit bfeb9e5

Please sign in to comment.