akka / akka

Build highly concurrent, distributed, and resilient message-driven applications on the JVM
https://akka.io
Other
13.03k stars 3.59k forks source link

Streaming marshalling and unmarshalling #21826

Open johanandren opened 7 years ago

johanandren commented 7 years ago

A bit vague, but for discussion (sparked by this comment in the Alpakka repo):

Given that we will likely need streaming marshalling and unmarshalling in Alpakka, and also in Akka HTTP (which already has it in JsonEntityStreamingSupport), should we provide some common abstractions for this out of the box with Akka streams to provide a canonical way to do unmarshalling/marshalling in streams (or is it perfectly fine and even important that there will be different approaches)?

jypma commented 7 years ago

One lib that I happen to have written myself that actually does streaming (un)marshalling, together with a nice mapping DSL, is ts-reaktive-marshal. It does push-model marshalling and unmarshalling. The base is stream-agnostic, so it e.g. can also work on RxJava. There are adapter classes for akka, and some akka-specific higher-level stream operators. For example, match certain parts of an XMLEvent stream, filter only those parts through a Flow, and have the result joined in again.

There's a bigger explanation on https://github.com/akka/alpakka/issues/63 .