akka / akka

Build highly concurrent, distributed, and resilient message-driven applications on the JVM
https://akka.io
Other
13.04k stars 3.59k forks source link

Networking in typed #27263

Open johanandren opened 5 years ago

johanandren commented 5 years ago

I think it is possible to use akka io from typed, but not quite sure. We should document how to do that, or recommend using streams instead in the docs (but then UDP requires alpakka?).

Bluexin commented 3 years ago

I am trying out some things with akka io (specifically UDP) from typed, and there's some issues like you're supposed to get the UDP actor ref by listening do Bound messages and checking the sender, but afaik you can't get the sender from a typed actor. I tried wrapping it in an adapter in the form of a classic actor wrapping the UDP events with their sender, but that seems like a bigger overhead :/

patriknw commented 3 years ago

I agree that it would be nice to introduce "sender" in the messages so that they are more compatible with Typed, but I guess the API isn't fully Typed anyway. Introducing a completely new Typed API for this seems low priority, since we prefer using Streams for this.

I think it's possible to access the sender via

context.toClassic.sender()
Bluexin commented 3 years ago

Yeah I switched to using Streams and it seems fine so far :)