-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Restructure workers * Add separate stream for events v jobs * Fix descriptions
- Loading branch information
1 parent
83b3afe
commit 706d32b
Showing
18 changed files
with
208 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
pub mod queue; | ||
|
||
pub use queue::QueueError; | ||
pub use queue::{QueueError, StreamError}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
use chat::ChatMessagePayload; | ||
|
||
pub mod chat; | ||
pub mod stream; | ||
pub use stream::Stream; | ||
|
||
/// Represents events we send and receive from NATS | ||
/// Primarily used to get the appropriate subject name for an event | ||
pub enum Event { | ||
ChatMessage(ChatMessagePayload), | ||
} | ||
|
||
pub const MESSAGE_PREFIX: &str = "farmhand"; | ||
pub const EVENT_PREFIX: &str = "events"; | ||
pub const JOB_PREFIX: &str = "jobs"; | ||
pub const EVENT_STREAM: &str = "FARMHAND_EVENTS"; | ||
pub const JOB_STREAM: &str = "FARMHAND_JOBS"; | ||
|
||
impl Event { | ||
pub fn get_subject(&self) -> String { | ||
match self { | ||
// farmhand.events.twitch.{broadcaster_name}.chat_message | ||
Event::ChatMessage(payload) => format!( | ||
"{}.{}.twitch.events.{}.chat_message", | ||
MESSAGE_PREFIX, EVENT_PREFIX, payload.broadcaster_user_name | ||
), | ||
} | ||
} | ||
} | ||
|
||
impl From<ChatMessagePayload> for Event { | ||
fn from(payload: ChatMessagePayload) -> Self { | ||
Event::ChatMessage(payload) | ||
} | ||
} |
Oops, something went wrong.