I need to model a series of LINEAR Akka Streams processing streams that model a 1 producer N consumers system.
As a quick reference, you can imagine having a single producer that produces messages in a Kafka topic, and N consumers that consume from that topic (with their own different consumer groups). In my specific case, however, this has all to be handled in memory, within the same process.
Since each linear stream is handled independently, I cannot use standard tools provided by Akka streams, such as the GraphDSL Broadcast operator. Each linear stream has to have its own Source and Sink.
Moreover, those linear streams are dynamically constructed at runtime, meaning I have to provide some reusable Source and Sink implementation.
I tried to use Actor interoperator (ActorSink.actorRefWithBackpressure()
for the producer and N ActorSource.actorRef()
for the consumers, but it doesn't model my case, as I cannot access the full stream materialized value, i.e. the source actor ref).
What I would need is something with the same semantics of the Kafka Source and Sink, but backed by a fully in-memory data structure. Is there anything (maybe in Alpakka) that I could use for this, otherwise what would be the correct approach?