score:3

Accepted answer

Source.unfoldResource is your friend, see docs here https://doc.akka.io/docs/akka/current/stream/operators/Source/unfoldResource.html#source-unfoldresource

It accepts three functions, one to open the resource, one to extract the next element to emit and one to close the resource when done or the stream fails etc.


Related Query

More Query from same tag