-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MTG-661 Add redis pool messenger (#81)
Co-authored-by: rwwwx <[email protected]>
- Loading branch information
Showing
9 changed files
with
465 additions
and
196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,34 @@ A message bus agnostic Messaging Library that sends Transaction, Account, Block | |
|
||
The plerkle serialization API changes at 1.0.0 which is a breaking change. | ||
This method removes confusion around the Recv data lifetime being tied back to the messenger interface. Now the data is owned. | ||
|
||
# Env example | ||
|
||
The Messenger can operate in two modes: a single Redis instance or multiple Redis instances. | ||
|
||
Just to clarify, the multiple Redis instances setup doesn't create a clustered connection. It's designed to work with separate, independent instances. | ||
|
||
You can configure the Redis client type via environment variables. | ||
|
||
Example environment configuration for a single Redis instance: | ||
|
||
``` | ||
export PLUGIN_MESSENGER_CONFIG='{ | ||
messenger_type="Redis", | ||
redis_connection_str="redis://:[email protected]:6379" | ||
}' | ||
``` | ||
|
||
Example environment configuration for multiple Redis instances: | ||
|
||
``` | ||
export PLUGIN_MESSENGER_CONFIG='{ | ||
messenger_type="RedisPool", | ||
redis_connection_str=[ | ||
"redis://:[email protected]:6379", | ||
"redis://:[email protected]:6379" | ||
] | ||
}' | ||
``` | ||
|
||
To switch between modes, you'll need to update both the `messenger_type` and `redis_connection_str` values. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
#[cfg(feature = "redis")] | ||
pub mod redis_messenger; | ||
|
||
mod error; | ||
mod metrics; | ||
mod plerkle_messenger; | ||
|
||
pub use crate::{error::*, plerkle_messenger::*}; | ||
pub mod redis; | ||
pub use redis::*; | ||
|
||
pub use {crate::error::*, plerkle_messenger::*}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
pub mod redis_messenger; | ||
pub mod redis_pool_messenger; | ||
|
||
// Redis stream values. | ||
pub const GROUP_NAME: &str = "plerkle"; | ||
pub const DATA_KEY: &str = "data"; | ||
pub const DEFAULT_RETRIES: usize = 3; | ||
pub const DEFAULT_MSG_BATCH_SIZE: usize = 10; | ||
pub const MESSAGE_WAIT_TIMEOUT: usize = 10; | ||
pub const IDLE_TIMEOUT: usize = 5000; | ||
pub const REDIS_MAX_BYTES_COMMAND: usize = 536870912; | ||
pub const PIPELINE_SIZE_BYTES: usize = REDIS_MAX_BYTES_COMMAND / 100; | ||
pub const PIPELINE_MAX_TIME: u64 = 10; | ||
|
||
pub(crate) const REDIS_CON_STR: &str = "redis_connection_str"; |
Oops, something went wrong.