diff options
author | 2022-08-21 14:09:50 -0700 | |
---|---|---|
committer | 2022-08-21 14:09:50 -0700 | |
commit | 5f4151e3044dc3f6849a357c398939463f028af6 (patch) | |
tree | 8f8c2610544d8bf1df426e4e41cd6a6ea676618f /rust/scraper/src/hub | |
parent | a75e41e9cce5d2e4ede08ef2def8add124a49c73 (diff) | |
download | touchpad-5f4151e3044dc3f6849a357c398939463f028af6.tar.gz touchpad-5f4151e3044dc3f6849a357c398939463f028af6.tar.zst touchpad-5f4151e3044dc3f6849a357c398939463f028af6.zip |
Adds RabbitMQ messaging and management hub
Diffstat (limited to 'rust/scraper/src/hub')
-rw-r--r-- | rust/scraper/src/hub/mod.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/rust/scraper/src/hub/mod.rs b/rust/scraper/src/hub/mod.rs new file mode 100644 index 0000000..0720f7c --- /dev/null +++ b/rust/scraper/src/hub/mod.rs @@ -0,0 +1,18 @@ +use lapin::message::Delivery; +use tokio::sync::mpsc::Receiver; +use proto::touchpad::common::v1; +use crate::TouchpadLiveClient; + +#[async_trait::async_trait] +pub trait Output { + async fn add_swimmer(&self, swimmer: &v1::Swimmer) -> Result<(), Box<dyn std::error::Error>>; + async fn add_team(&self, team: &v1::Team) -> Result<(), Box<dyn std::error::Error>>; + async fn add_meet(&self, meet: &v1::SwimMeet) -> Result<(), Box<dyn std::error::Error>>; + async fn upsert_event(&self, event: &v1::Event) -> Result<(), Box<dyn std::error::Error>>; +} + +pub struct Hub<'a> { + source: TouchpadLiveClient<'a>, + outputs: Vec<Box<dyn Output>>, + messages: Receiver<Delivery>, +} |