Skip to content

Commit

Permalink
Refactor Redis broker
Browse files Browse the repository at this point in the history
  • Loading branch information
Will Nelson committed May 24, 2022
1 parent e7a4686 commit 94c53e7
Show file tree
Hide file tree
Showing 8 changed files with 693 additions and 794 deletions.
871 changes: 434 additions & 437 deletions Cargo.lock

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions brokers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
deadpool-redis = { version = "0.9", optional = true }
lapin = { version = "1.1", optional = true }
bytes = "1.1"
env_logger = "0.7"
futures = "0.3"
log = "0.4"
nanoid = "0.3"
pin-project = "1.0"
redis = { version = "0.21", optional = true, default-features = false, features = ["streams"] }
redis-subscribe = { git = "https://github.com/appellation/redis-subscribe", branch = "feat/impl-error", optional = true }
redust = { version = "0.1", features = ["model", "pool"], optional = true }
rmp-serde = "0.15"
serde = "1.0"
serde_bytes = "0.11"
thiserror = "1.0"
tokio = "1.0"
tokio-stream = { version = "0.1", features = ["sync"] }
Expand All @@ -32,7 +32,7 @@ features = ["rt-multi-thread", "macros"]

[features]
amqp-broker = ["lapin"]
redis-broker = ["deadpool-redis", "redis", "redis-subscribe"]
redis-broker = ["redust"]

[[example]]
name = "amqp_consumer"
Expand Down
10 changes: 2 additions & 8 deletions brokers/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#[cfg(feature = "redis-broker")]
use deadpool_redis::{redis::RedisError, PoolError};
#[cfg(feature = "amqp-broker")]
use lapin::Error as LapinError;
use std::{io::Error as IoError, result::Result as StdResult};
Expand Down Expand Up @@ -31,15 +29,11 @@ pub enum Error {

#[cfg(feature = "redis-broker")]
#[error("Redis error")]
Redis(#[from] RedisError),
Redis(#[from] redust::Error),

#[cfg(feature = "redis-broker")]
#[error("Pool error")]
Deadpool(#[from] PoolError),

#[cfg(feature = "redis-broker")]
#[error("Redis subscribe error")]
RedisSub(#[from] redis_subscribe::Error),
Pool(#[from] redust::pool::PoolError),

#[error("MessagePack encode error")]
MsgpackEncode(#[from] rmp_serde::encode::Error),
Expand Down
Loading

0 comments on commit 94c53e7

Please sign in to comment.