make the aggregate method send

This commit is contained in:
Tamo 2024-10-17 00:43:34 +02:00
parent 6728cfbfac
commit aa7a34ffe8
2 changed files with 5 additions and 2 deletions

View File

@ -110,7 +110,7 @@ mopafy!(Aggregate);
/// Helper trait to define multiple aggregate with the same content but a different name.
/// Commonly used when you must aggregate a search with POST or with GET for example.
pub trait AggregateMethod: 'static + Default {
pub trait AggregateMethod: 'static + Default + Send {
fn event_name() -> &'static str;
}

View File

@ -72,9 +72,12 @@ pub fn extract_user_agents(request: &HttpRequest) -> Vec<String> {
}
pub struct Message {
// Since the type_id is solved statically we cannot retrieve it from the Box.
// Thus we have to send it in the message directly.
type_id: TypeId,
event: Box<dyn Aggregate>,
// Same for the aggregate function.
aggregator_function: fn(Box<dyn Aggregate>, Box<dyn Aggregate>) -> Option<Box<dyn Aggregate>>,
event: Box<dyn Aggregate>,
}
impl Message {