mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-13 08:36:54 +00:00
feat: integrate event-notifier system with rustfs
- Rename package from rustfs-event-notifier to event-notifier for consistency - Add shutdown hooks for event notification system in main process - Handle graceful termination of notification services on server shutdown - Implement initialization and configuration loading for event notification - Fix environment variable configuration to properly parse adapter arrays - Update example code to demonstrate proper configuration usage This change ensures proper integration between rustfs and the event notification system, with clean startup and shutdown sequences to prevent resource leaks during application lifecycle.
This commit is contained in:
@@ -29,10 +29,10 @@ async fn main() -> Result<(), Box<dyn error::Error>> {
|
||||
})],
|
||||
};
|
||||
|
||||
// load_config
|
||||
// event_load_config
|
||||
// loading configuration from environment variables
|
||||
let _config = NotifierConfig::load_config(Some("./crates/event-notifier/examples/event.toml".to_string()));
|
||||
tracing::info!("load_config config: {:?} \n", _config);
|
||||
let _config = NotifierConfig::event_load_config(Some("./crates/event-notifier/examples/event.toml".to_string()));
|
||||
tracing::info!("event_load_config config: {:?} \n", _config);
|
||||
|
||||
let system = Arc::new(tokio::sync::Mutex::new(NotifierSystem::new(config.clone()).await?));
|
||||
let adapters = create_adapters(&config.adapters)?;
|
||||
|
||||
@@ -102,9 +102,9 @@ impl NotifierConfig {
|
||||
/// ```
|
||||
/// use rustfs_event_notifier::NotifierConfig;
|
||||
///
|
||||
/// let config = NotifierConfig::load_config(None);
|
||||
/// let config = NotifierConfig::event_load_config(None);
|
||||
/// ```
|
||||
pub fn load_config(config_dir: Option<String>) -> NotifierConfig {
|
||||
pub fn event_load_config(config_dir: Option<String>) -> NotifierConfig {
|
||||
let config_dir = if let Some(path) = config_dir {
|
||||
// If a path is provided, check if it's empty
|
||||
if path.is_empty() {
|
||||
|
||||
Reference in New Issue
Block a user