amico_lib/impls/
event_generator_impl.rs

1use amico_core::entities::Event;
2use amico_core::traits::EventGenerator;
3use std::any::Any;
4use std::collections::HashMap;
5use std::sync::Arc;
6use std::thread;
7use std::time::Duration;
8
9/// Implementation of the EventGenerator trait.
10#[derive(Default)]
11pub struct EventGeneratorImpl;
12
13impl EventGenerator for EventGeneratorImpl {
14    fn generate_event(
15        &self,
16        source: String,
17        params: HashMap<String, Arc<dyn Any + Send + Sync>>,
18    ) -> Vec<Event> {
19        // Generate and return a list of example events
20        println!("Generating event with source: {}", source);
21        // Simulate some processing time
22        thread::sleep(Duration::from_millis(100));
23        vec![Event::new("ExampleEvent".to_string(), source, params, None)]
24    }
25}