I am trying to create a pair of Flow graphs that support some conversion between ByteString and T. The inbound ByteString messages are chunked by a fixed size (e.g. 8K) thus boundaries land at arbitrary points in the data being processed. As such, the in to out message processing is not 1:1, but is many:many.
The following is how I envision my signatures: def deserializeFlow = Flow[ByteString, T, NotUsed] def serializeFlow = Flow[T, ByteString, NotUsed] Some of the libraries I currently have for serialization are from legacy projects that are familiar with java.util.InputStream and java.util.OutputStream. Starting with the deserializeFlow, I am struggling to find a clean and concise way of encapsulating: 1. conversion of the InLet[ByteString] messages into a single InputStream. 2. wrap the InputStream with business logic to emit an Iterator[T] 3. Turn the Iterator[T] into the OutLet[T] I know the StreamConverters.asInputStream Sink exists, but this requires materialization of a Sink, and this seems to throw me. I've had a difficult time comprehending how to do this within a flow that is "in flight". One thought I've had is to build an actor that manages this conversion, but I've come to realize Streams usually provide a safer/cleaner/better way. Finding out what that way is tends to be the big challenge. Thoughts or suggestions? Have I missed something standard and am now reinventing the wheel? Thanks, James -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.
