Spinning threads to babysit blocking IO streams is a time-honoured, albeit
extremely distasteful, technique.  You might be interested in a "push-pull"
parser, courtesy of Tatu Saloranta: http://wiki.fasterxml.com/AaltoHome

-0xe1a

On Tue, Sep 8, 2015 at 2:30 AM, Sarah Gerweck <sarah.a...@gmail.com> wrote:

> I'm a bit new to Akka Streams and hoping somebody could take a quick look
> at what I've done and tell me if there's a better way to do it.
>
> I've been working on a project where I have XML documents that I want to
> reformat as part of a project that uses Akka Streams & Akka HTTP. (These
> documents are large enough that it's worthwhile to do it with streaming.)
>
> The JVM ships with streaming XML formatting, but it's based on the
> traditional InputStream / OutputStream concepts. I didn't find any really
> elegant way to bridge this to Akka Streams other than using two
> PipedInputStream/PipedOutputStream pairs along with a dedicated thread to
> run the transformer.
>
> I put my code in a Gist: XmlPrettyPrinter Flow
> <https://gist.github.com/sarahgerweck/6493957338f0a364dc12>.
>
> Is this the best I can do in terms of integrating an InputStream-to-
> OutputStream flow into an Akka Streams flow? I think this approach is
> sound, and its performance isn't too bad as long as I give it a reasonably
> sized buffer, but having to make two PipedStream pairs and a dedicated
> thread is a bit kludgy, so I figured it's worth asking if there's a cleaner
> way to do what I'm doing here, short of writing a new formatter.
>
> Thanks,
>   *Sarah*
>
> --
> >>>>>>>>>> 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 akka-user+unsubscr...@googlegroups.com.
> To post to this group, send email to akka-user@googlegroups.com.
> Visit this group at http://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
>>>>>>>>>>      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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to