Let's say I have a Source:
val source = Source(List(1,2,3))
How can I message the source like an actor?
sourceActor ! 4
Let's say I have a Source:
val source = Source(List(1,2,3))
How can I message the source like an actor?
sourceActor ! 4
You can't use simple collection-based source like that. You need another one like Source.actorRef
or Source.queue
. Keep in mind that using Source.actorRef
does not give you backpressure and that messages send remotely over the network may get lost (due to at-most-once delivery semantic of actor communication).
Also, there's an entire section in Akka documentation about integrating actors.