public final class CsvEntityStreamingSupport extends CsvEntityStreamingSupport
Constructor and Description |
---|
CsvEntityStreamingSupport(int maxObjectSize) |
CsvEntityStreamingSupport(int maxLineLength,
ContentTypeRange supported,
ContentType contentType,
akka.stream.scaladsl.Flow<akka.util.ByteString,akka.util.ByteString,akka.NotUsed> framingRenderer,
int parallelism,
boolean unordered) |
Modifier and Type | Method and Description |
---|---|
ContentType |
contentType()
Write-side, defines what Content-Type the Marshaller should offer and the final Content-Type of the response.
|
akka.stream.scaladsl.Flow<akka.util.ByteString,akka.util.ByteString,akka.NotUsed> |
framingDecoder()
Read-side, decode incoming framed entity.
|
akka.stream.scaladsl.Flow<akka.util.ByteString,akka.util.ByteString,akka.NotUsed> |
framingRenderer()
Write-side, apply framing to outgoing entity stream.
|
int |
parallelism()
Write-side / read-side, defines if (un)marshalling should be done in parallel.
|
ContentTypeRange |
supported()
Read-side, what content types it is able to frame and unmarshall.
|
java.lang.String |
toString() |
boolean |
unordered()
Write-side / read-side, defines if (un)marshalling should preserve ordering of incoming stream elements.
|
CsvEntityStreamingSupport |
withContentType(ContentType ct)
Write-side, defines what Content-Type the Marshaller should offer and the final Content-Type of the response.
|
CsvEntityStreamingSupport |
withFramingRenderer(akka.stream.scaladsl.Flow<akka.util.ByteString,akka.util.ByteString,akka.NotUsed> framingRendererFlow) |
CsvEntityStreamingSupport |
withFramingRendererFlow(akka.stream.javadsl.Flow<akka.util.ByteString,akka.util.ByteString,akka.NotUsed> framingRendererFlow)
Java API: Write-side, apply framing to outgoing entity stream.
|
CsvEntityStreamingSupport |
withParallelMarshalling(int parallelism,
boolean unordered)
Write-side / read-side, defines parallelism and if ordering should be preserved or not of Source element marshalling.
|
CsvEntityStreamingSupport |
withSupported(ContentTypeRange range)
Read-side, allows changing what content types are accepted by this framing.
|
csv, csv, getFramingDecoder, getFramingRenderer, json, json
public CsvEntityStreamingSupport(int maxLineLength, ContentTypeRange supported, ContentType contentType, akka.stream.scaladsl.Flow<akka.util.ByteString,akka.util.ByteString,akka.NotUsed> framingRenderer, int parallelism, boolean unordered)
public CsvEntityStreamingSupport(int maxObjectSize)
public ContentType contentType()
EntityStreamingSupport
contentType
in class EntityStreamingSupport
public akka.stream.scaladsl.Flow<akka.util.ByteString,akka.util.ByteString,akka.NotUsed> framingDecoder()
EntityStreamingSupport
framingDecoder
in class EntityStreamingSupport
public akka.stream.scaladsl.Flow<akka.util.ByteString,akka.util.ByteString,akka.NotUsed> framingRenderer()
EntityStreamingSupport
Most typical usage will be a variant of Flow[ByteString].intersperse
.
For example for rendering a JSON array one would return
Flow[ByteString].intersperse(ByteString("["), ByteString(","), ByteString("]"))
and for rendering a new-line separated CSV simply Flow[ByteString].intersperse(ByteString("\n"))
.
framingRenderer
in class EntityStreamingSupport
public int parallelism()
EntityStreamingSupport
This may be beneficial marshalling the bottleneck in the pipeline.
See also parallelism
and withParallelMarshalling
.
parallelism
in class EntityStreamingSupport
public ContentTypeRange supported()
EntityStreamingSupport
supported
in class EntityStreamingSupport
public java.lang.String toString()
toString
in class java.lang.Object
public boolean unordered()
EntityStreamingSupport
Allowing for parallel and unordered (un)marshalling often yields higher throughput and also allows avoiding head-of-line blocking if some elements are much larger than others.
See also parallelism
and withParallelMarshalling
.
unordered
in class EntityStreamingSupport
public CsvEntityStreamingSupport withContentType(ContentType ct)
EntityStreamingSupport
EntityStreamingSupport traits MUST support re-configuring the offered ContentType
.
This is due to the need integrating with existing systems which sometimes expect custom Content-Types,
however really are just plain JSON or something else internally (perhaps with slight extensions).
NOTE: Implementations should specialize the return type to their own Type!
withContentType
in class EntityStreamingSupport
ct
- (undocumented)public CsvEntityStreamingSupport withFramingRenderer(akka.stream.scaladsl.Flow<akka.util.ByteString,akka.util.ByteString,akka.NotUsed> framingRendererFlow)
public CsvEntityStreamingSupport withFramingRendererFlow(akka.stream.javadsl.Flow<akka.util.ByteString,akka.util.ByteString,akka.NotUsed> framingRendererFlow)
CsvEntityStreamingSupport
Most typical usage will be a variant of Flow[ByteString].intersperse
.
For example for rendering a JSON array one would return
Flow[ByteString].intersperse(ByteString("["), ByteString(","), ByteString("]"))
and for rendering a new-line separated CSV simply Flow[ByteString].intersperse(ByteString("\n"))
.
withFramingRendererFlow
in class CsvEntityStreamingSupport
framingRendererFlow
- (undocumented)public CsvEntityStreamingSupport withParallelMarshalling(int parallelism, boolean unordered)
EntityStreamingSupport
Sometimes marshalling multiple elements at once (esp. when elements are not evenly sized, and ordering is not enforced) may yield in higher throughput.
NOTE: Implementations should specialize the return type to their own Type!
withParallelMarshalling
in class EntityStreamingSupport
parallelism
- (undocumented)unordered
- (undocumented)public CsvEntityStreamingSupport withSupported(ContentTypeRange range)
EntityStreamingSupport
EntityStreamingSupport traits MUST support re-configuring the accepted ContentTypeRange
.
This is in order to support a-typical APIs which users still want to communicate with using
the provided support trait. Typical examples include APIs which return valid application/json
however advertise the content type as being application/javascript
or vendor specific content types,
which still parse correctly as JSON, CSV or something else that a provided support trait is built for.
NOTE: Implementations should specialize the return type to their own Type!
withSupported
in class EntityStreamingSupport
range
- (undocumented)