Hello, I am writing a REST service that serves aggregated statistics of multicast message flow.
It listens to a multicast socket and keeps track of the messages it receives. In response to some REST operations it also needs to send a multicast message (to a different group).
Right now, I've structured it as two
launch
-ed coroutines on the IO dispatcher, using blocking
receive()
and
send()
with timeout, one draining an outbound channel, the other directly updating a map with statistics (guarded by
synchronized
section).
Is this the idiomatic way? Am I supposed to use one of the
Flow
implementations? Can I somehow plug my I/O into Ktor's selector?