Quantcast
Channel: Akka Libraries - Discussion Forum for Akka technologies
Viewing all articles
Browse latest Browse all 1369

Custom EntityStreamingSupport

$
0
0

Hello,
I’m trying to create a new implementation of EntityStreamingSupport.

Here is my actual code:

class ChecksumStreamingSupport private[akka](
                                              maxObjectSize: Int,
                                              val supported: ContentTypeRange,
                                              val contentType: ContentType,
                                              val framingRenderer: Flow[ByteString, ByteString, NotUsed],
                                              val parallelism: Int,
                                              val unordered: Boolean
                                            ) extends EntityStreamingSupport {

  def this(maxObjectSize: Int) =
    this(
      maxObjectSize,
      ContentTypeRange(ContentTypes.`application/octet-stream`),
      ContentTypes.`application/octet-stream`,
      Flow[ByteString].intersperse(ByteString("["), ByteString(","), ByteString("]")),
      1, false)

  override def framingDecoder: Flow[ByteString, ByteString, NotUsed] = ???

  override def withSupported(range: jm.ContentTypeRange): EntityStreamingSupport = new ChecksumStreamingSupport(maxObjectSize, range, contentType, framingRenderer, parallelism, unordered)

  override def withContentType(contentType: jm.ContentType): EntityStreamingSupport = new ChecksumStreamingSupport(maxObjectSize, supported, contentType, framingRenderer, parallelism, unordered)

  override def withParallelMarshalling(parallelism: Int, unordered: Boolean): EntityStreamingSupport = ???
}

The problem is I can’t use the #asScala method. To translate Java components to Scala because the import akka.http.impl.util.JavaMapping class is unaccessible. (The prodived code is based on the ScalaDSL’s JsonStreamingEntitySupport)

So I’m asking for a workaround or link to the unfound documentation part.

Have a good day !

Edit: this new implementation is to serialize a checkum so a binary format.

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 1369

Latest Images

Trending Articles



Latest Images