I am working with Akka Streams and I want to build a custom RunnableGraph at runtime depending on some configuration that is not known beforehand.
For example:
RunnableGraph.fromGraph(GraphDSL.create() { implicit builder =>
val source = builder.add(mySource)
if (A) {
builder.add(flowX)
} else {
builder.add(flowY)
}
ClosedShape
})
Is this possible, or is there a more elegant way of composing a runnable graph at runtime to pass around and execute later?