improve channel adapter

This commit is contained in:
houseme
2025-05-21 16:44:59 +08:00
parent 1c088546b3
commit 0f22b21c8d
21 changed files with 278 additions and 372 deletions
+3 -2
View File
@@ -1,5 +1,6 @@
use rustfs_event::{
AdapterConfig, Bucket, Error as NotifierError, Event, Identity, Metadata, Name, NotifierConfig, Object, Source, WebhookConfig,
AdapterConfig, Bucket, ChannelAdapterType, Error as NotifierError, Event, Identity, Metadata, Name, NotifierConfig, Object,
Source, WebhookConfig,
};
use std::collections::HashMap;
use tokio::signal;
@@ -103,7 +104,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
})
.s3(metadata)
.source(source)
.channels(vec!["webhook".to_string()])
.channels(vec![ChannelAdapterType::Webhook.to_string()])
.build()
.expect("failed to create event");
+3 -3
View File
@@ -1,5 +1,5 @@
use rustfs_event::create_adapters;
use rustfs_event::NotifierSystem;
use rustfs_event::{create_adapters, ChannelAdapterType};
use rustfs_event::{AdapterConfig, NotifierConfig, WebhookConfig};
use rustfs_event::{Bucket, Event, Identity, Metadata, Name, Object, Source};
use std::collections::HashMap;
@@ -31,7 +31,7 @@ async fn main() -> Result<(), Box<dyn error::Error>> {
// event_load_config
// loading configuration from environment variables
let _config = NotifierConfig::event_load_config(Some("./crates/event-notifier/examples/event.toml".to_string()));
let _config = NotifierConfig::event_load_config(Some("./crates/event/examples/event.toml".to_string()));
tracing::info!("event_load_config config: {:?} \n", _config);
dotenvy::dotenv()?;
let _config = NotifierConfig::event_load_config(None);
@@ -77,7 +77,7 @@ async fn main() -> Result<(), Box<dyn error::Error>> {
})
.s3(metadata)
.source(source)
.channels(vec!["webhook".to_string()])
.channels(vec![ChannelAdapterType::Webhook.to_string()])
.build()
.expect("failed to create event");