Akka streaming broadcast


I have a grpc service where the server is streaming the result of some calculation to clients. The requirement is that all clients will get the same result. The calculation runs periodically.

What I have just now is the following:

val graph =
      .tick(delay,interval, SomeTick())
      .map(x=> calc(x))
      .toMat(BroadcastHub.sink(bufferSize = 256))(Keep.right)

val drainer = graph.run.runWith(Sink.ignore)

override def service(): Source[Something, NotUsed] = {

I’m not sure if this is correct or not, as it seems to hang some of the time. Can anyone recommend the best approach for this?