If you modify your code a bit then your stream will be materialized into multiple Actor
values. These materialized Actors will get you the concurrency you are looking for:
val future =
SqsSource(sqsEnpoint)(awsSqsClient) //Actor 1
.via(Flow[Message] map (m => (m, Ack()))) //Actor 2
.to(SqsAckSink(sqsEndpoint)(awsSqsClient)) //Actor 3
.run()
Note the use of via
and to
. These are important because they indicate that those stages of the stream should be materialized into separate Actors. In your example code you are using map
and runWith
on the Source
which would result in only 1 Actor being created because of operator fusion.
Flows that Ask External Actors
If you're looking to extend to even more Actors then you can use Flow#mapAsync
to query an external Actor to do more work, similar to this example.