futures-zmq 0.1.0

Provides Futures abstractions for ZeroMQ on any futures executor
Documentation

Futures ZMQ

documentation crates.io

This crate contains wrappers around ZeroMQ Concepts with Futures.

See the examples folder for usage examples.

Getting Started

futures-zmq = "0.1"
futures = "0.1.25"

In your application:

use std::sync::Arc;

use futures::Future;
use futures_zmq::Session;

fn main() {
    let ctx = Arc::new(zmq::Context::new());
    let socket = ctx.socket(SocketType::REP)
        .unwrap();

    socket.bind("tcp://*:5560")
        .unrwap();

    let session = Session::new();

    session.recv(socket)
        .and_then(move |(socket, message)| {
            /// Echo the message back to the client
            session.send(socket, message, 0)
        })
        .wait()
        .unwrap();
}

Running the examples

The req.rs and rep.rs examples are designed to be used together. The rep example starts a server with a REP socket, and the req example queries that server with a REQ socket.

Contributing

Feel free to open issues for anything you find an issue with. Please note that any contributed code will be licensed under the GPLv3.

License

Copyright © 2018 Riley Trautman

Futures ZMQ is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Futures ZMQ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. This file is part of Futures ZMQ.

You should have received a copy of the GNU General Public License along with Futures ZMQ. If not, see http://www.gnu.org/licenses/.