I've got a question regarding akka streams.

I've got a question regarding akka streams. I've got a USB device from which I can only read in a blocking manner. However, I'd like to create an asynchronous stream out of it. Has anyone attempted such a thing before? Or is there an example on to do this?
You already invited:

Alzico

Upvotes from:

Yes it can be done. If I am correct in assuming you will be using an InputStream or similar, then you will likely want to use Source.unfoldResourceAsync(...) since it has hooks to close the resource once the stream terminates.
Just make sure that all the methods it calls execute the blocking code within scala.concurrent.blocking or are explicitly given a blocking dedicated execution context.

If you wanna answer this question please Login or Register