I have the following simple case class hierarchy:
sealed trait Message
case class Foo(bar: Int) extends Message
case class Baz(qux: String) extends Message
And I have a Flow[Message, Message, NotUsed]
(from a Websocket-based protocol with codec already in place).
I want to demultiplex this Flow[Message]
into separate flows for Foo and Baz types, as those are processed by completely different pathways.
What is the simplest way of doing that? Should be obvious, but I am missing something...