Feature/event: Optimize and Enhance Notify Crate Functionality (#512)

* improve code for notify

* fix

* cargo fmt

* improve code and create `DEFAULT_DELIMITER`

* fix

* fix

* improve code for notify

* fmt

* Update crates/notify/src/registry.rs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update crates/notify/src/factory.rs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix cllipy

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
houseme
2025-06-26 12:24:00 +08:00
committed by GitHub
parent 61e600b9ba
commit 831cb0b6d9
31 changed files with 342 additions and 151 deletions
+1 -1
View File
@@ -57,7 +57,7 @@ protos.workspace = true
query = { workspace = true }
regex = { workspace = true }
rmp-serde.workspace = true
rustfs-config = { workspace = true, features = ["constants"] }
rustfs-config = { workspace = true, features = ["constants", "notify"] }
rustfs-notify = { workspace = true }
rustfs-obs = { workspace = true }
rustfs-utils = { workspace = true, features = ["full"] }
+9 -1
View File
@@ -1,4 +1,5 @@
use ecstore::config::GLOBAL_ServerConfig;
use rustfs_config::DEFAULT_DELIMITER;
use tracing::{error, info, instrument};
#[instrument]
@@ -14,8 +15,15 @@ pub(crate) async fn init_event_notifier() {
}
};
info!("Global server configuration loaded successfully. config: {:?}", server_config);
// 2. Check if the notify subsystem exists in the configuration, and skip initialization if it doesn't
if server_config.get_value("notify", "_").is_none() {
if server_config
.get_value(rustfs_config::notify::NOTIFY_MQTT_SUB_SYS, DEFAULT_DELIMITER)
.is_none()
|| server_config
.get_value(rustfs_config::notify::NOTIFY_WEBHOOK_SUB_SYS, DEFAULT_DELIMITER)
.is_none()
{
info!("'notify' subsystem not configured, skipping event notifier initialization.");
return;
}
+1 -1
View File
@@ -634,7 +634,7 @@ fn handle_connection_error(err: &(dyn std::error::Error + 'static)) {
} else {
error!("Unknown hyper error:{:?}", hyper_err);
}
} else if let Some(io_err) = err.downcast_ref::<std::io::Error>() {
} else if let Some(io_err) = err.downcast_ref::<Error>() {
error!("Unknown connection IO error:{}", io_err);
} else {
error!("Unknown connection error type:{:?}", err);