(mut self, callback: F)
| 514 | } |
| 515 | |
| 516 | pub fn with_publish_bus<F, Fut>(mut self, callback: F) -> Self |
| 517 | where |
| 518 | F: Fn(String, serde_json::Value) -> Fut + Send + Sync + 'static, |
| 519 | Fut: std::future::Future<Output = ()> + Send + 'static, |
| 520 | { |
| 521 | self.publish_bus = Some(Arc::new(move |event_type, properties| { |
| 522 | Box::pin(callback(event_type, properties)) |
| 523 | })); |
| 524 | self |
| 525 | } |
| 526 | |
| 527 | pub async fn do_publish_bus(&self, event_type: &str, properties: serde_json::Value) { |
| 528 | if let Some(ref callback) = self.publish_bus { |