TMQ - Rust ZeroMQ bindings for Tokio
This crate bridges Tokio and ZeroMQ to allow for ZeroMQ in the async world.
Changelog
0.3.1 - Iter Mut for Multipart
Adds an iter_mut()
method to Multipart
0.3.0 - Tokio 1.0 Support
0.3.0 adds support for tokio 1.0 thanks to YushiOMOTE!
Currently Implemented Sockets
- Request/Reply
- Publish/Subscribe
- Dealer/Router
- Push/Pull
Examples
Please see the examples
directory for a full set of examples. They are paired together based upon the socket types.
Usage
Usage is made to be simple, but opinionated. See the examples for working code, but in general, you need to import tokio
and tmq::*
Publish
To publish messages to all connected subscribers, you can use the publish
function:
use ;
use SinkExt;
use info;
use env;
use Duration;
use delay_for;
async
Subscribe
a subscribe socket is a Stream
that reads in values from a publish socket. You specify the filter prefix using the subscribe
method, using ""
for all messages.
use StreamExt;
use ;
use env;
async