pub async fn initialize_and_start(
config: NotificationConfig,
) -> Result<(), Error>Expand description
Initialize and start the global notification system
This method combines the functions of initialize and start to provide one-step setup:
- initialize system configuration
- create an adapter
- start event listening
§Example
use event_notification::{initialize_and_start, NotificationConfig};
#[tokio::main]
async fn main() -> Result<(), event_notification::Error> {
let config = NotificationConfig {
store_path: "./events".to_string(),
channel_capacity: 100,
adapters: vec![/* 适配器配置 */],
};
// complete initialization and startup in one step
initialize_and_start(config).await?
}