-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(*): Completes spike of HA stream architecture #60
feat(*): Completes spike of HA stream architecture #60
Conversation
This adds some code for handling the event streams and a basic setup of the wadm binary. Much of the code in the binary will likely need to be refactored into library code, but it is good enough to prove that things work. I might do another follow on PR to this to maybe clean up a few more things. Closes wasmCloud#42 Signed-off-by: Taylor Thomas <[email protected]>
Given that this is experimental to prove that certain aspects of the design work, this all LGTM. Just take care to make sure that all the hardcoded bits (e.g. using |
async fn send_fake_command(context: &Context, host_id: &str, event: &Event) -> anyhow::Result<()> { | ||
use wadm::nats_utils::ensure_send; | ||
let command: Command = match event { | ||
Event::ActorStarted(actor) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is test, so I'm assuming this is just mock data... but wadm wouldn't emit a start actor command in response to an actor started event.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, totally something to demo it works and so I knew what would be coming out the other end!
// NOTE: These functions will probably need to be replaced with something in the library code, but | ||
// they're good enough for testing | ||
async fn handle_events(stream: Stream, context: Context, host_id: String) -> anyhow::Result<()> { | ||
let mut consumer = EventConsumer::new(stream, "wasmbus.evt.default") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assuming this hard coded topic is just because this is a test/experiment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, 100% hard coded. If you take a look at #61 you'll see that I made something to support multiple.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love the tests, architecture seems solid. I'll leave @autodidaddict to some details of HA, I left some nits
#[arg(short = 'd', env = "WADM_JETSTREAM_DOMAIN")] | ||
domain: Option<String>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Might be nice to have this be -j
and --js-domain
to match NATS
@@ -0,0 +1,123 @@ | |||
//! A module for creating and consuming a stream of events from a wasmcloud lattice |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: copy paste comment
Thanks for the ideas @brooksmtownsend! I'll wrap those nits up in #61 |
This adds some code for handling the event streams and a basic setup of the wadm binary. Much of the code in the binary will likely need to be refactored into library code, but it is good enough to prove that things work. I might do another follow on PR to this to maybe clean up a few more things.
Sorry for how giant this is, it was what was needed to get things working
Closes #42