The Java graph DSL isn’t that different, the squiggly arrows (
~>) corresponds to
builder.via and you might
need to manually perform some more builder.add calls to add stages than the Scala code does, but you
should be able to create something pretty much like it with Java.
The docs on the Java GraphDSL can be found here:
In the sample I gave you the Flow<Message, Message, ?> is created by first returning a FlowShape from the
block that creates the graph (in Scala the last value is returned, no return statement needed), and then passing the
resulting Graph<FlowShape<Message, Message,…>> to Flow.fromGraph.
If it wasn’t for the fact that we needed to pass the outgoing message actorref to the connection-actor we could
have just used Flow.fromSinkAndSource(sink, source) to construct it.
—