Redis Stream
A Rust high-level library to consume data from Redis streams.
This project is a slightly modified port of the Elixir Redix.Stream library to Rust and comes as an extension of redis-rs.
Installation
The crate is called redis-stream
and you can depend on it via cargo:
[dependencies]
redis-stream = "0.1.0"
Documentation
Documentation on the library can be found at docs.rs/redis-stream.
Basic usage:
use ;
let redis_url =
var.unwrap_or_else;
let mut redis = open
.expect
.get_connection
.expect;
// Message handler
let handler = ;
// Consumer config
let opts = default;
let mut consumer = init.expect;
// Consume some messages through handler.
consumer.consume.expect;
// Clean up redis
use Commands;
redis..expect;
Consumer groups usage:
use ;
let redis_url =
var.unwrap_or_else;
let mut redis = open
.expect
.get_connection
.expect;
// Message handler
let handler = ;
// Consumer config
let opts = default.group;
let mut consumer = init.unwrap;
// Consume some messages through handler.
consumer.consume.expect;
// Clean up redis
use Commands;
redis..expect;
redis..expect;
Development
If you want to develop on the library, there are a few commands provided by the makefile.
Run make help
to get more info.
For testing, a docker-compose.yml
file is also available if you need to start a local redis instance:
License
Please see LICENSE