akka / akka-edge-rs

Akka Edge support in Rust
https://doc.akka.io/docs/akka-edge/current/
Other
9 stars 1 forks source link

Initial UI #31

Closed huntc closed 1 year ago

huntc commented 1 year ago

This is a UI component written using Yew/Webassembly that demonstrates akka-edge-rs running in the browser, and also integrated over http with the iot-example backend. No changes were required to the akka-edge-rs libraries to make this happen.

The example illustrates how state and event declarations can be shared across the frontend and backend. In particular, an on_event method has been declared on the state so that the frontend can nicely event source state received from the backend. No entity manager runs in the frontend, which is what we want as we only need the state of an entity in relation to the events received from the backend.

Full error handling of event sourcing from the backend via Server-Sent Events is provided.

Preview of the UI:

image

Fixes #27

huntc commented 1 year ago

While not a huge amount of stuff added to the "backend", could it make sense to keep one sample project that doesn't have the SSE event stream in there to keep things simple?

This example reflects what I’ve used in the real world. I’d prefer to keep it as close to real-world as possible. SSE has played a key role in my edge-based apps, so I don't recommend avoiding SSE. Having the UI be responsive leads to a great user experience.

huntc commented 1 year ago

If I read this now I might expect that is also required for the event replication. Maybe just clearly documenting that could be enough. Not sure.

You mean Replicated Event Sourcing? I would think that the difference here between replicated event sourcing and what we're doing here with a single producer should be obvious to the developer. Let's chat this through though if this remains a concern.

johanandren commented 1 year ago

I'm still somewhat unhappy about not also having simpler version of the example that is more bare bones and does not publish events to a web UI but is only there to replicate events from devices to a more central system.

huntc commented 1 year ago

I'm still somewhat unhappy about not also having simpler version of the example that is more bare bones and does not publish events to a web UI but is only there to replicate events from devices to a more central system.

Noted. Let's discuss offline.

huntc commented 1 year ago

If I read this now I might expect that is also required for the event replication. Maybe just clearly documenting that could be enough. Not sure.

I think this should be cleared up once we re-frame the SSE code in the light of that becoming wrapped up as a projection. You're right in that our SSE code here is similar to what we have with gRPC projections. My main aim was to get this code down first. I'm going to move on to filter support next, and then I think it should become obvious how we can abstract the SSE functionality.