New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Offer Flow from Source => Source function #26592
Comments
You can use val source = Source(0 to 5)
val duplicator: Int => Source[Int, NotUsed] = el => Source(List(el, el))
source.flatMapConcat(duplicator).runForeach(println) |
I already found a solution:
It uses prefixAndTail to highjack the underyling Source. |
Ahh, I misunderstood. Good that you found a solution. |
@2m Anyway, I appreciate your help! It took me half a day to figure out that “hack”... |
Good find, that is definitely not trivial! Perhaps we should have a convenience method for this somewhere, or at least mention it as a pattern somewhere in the docs? |
@raboof I basically started to write my own GraphStage until I found out that I am actually cloning prefixAndTail... Yes, could be just added as FlowOps.via(func: (Source) => Source). |
Assume we have a function of type
These are for example being generated by the akka-grpc framework.
We would like to have a method to construct a Flow from func:
The text was updated successfully, but these errors were encountered: