Hi,

I have below Actor which can return a chunked response:


class DemoActor extends Actor {

  override def receive: Receive = {
    case req: HttpRequest =>

      val source = Source(List(Chunk("Hello"), Chunk("World"), LastChunk))
      sender() ! HttpResponse(entity = 
HttpEntity.Chunked(ContentTypes.`text/plain`, source))

  }
}

However, I'd like to drive the source by sending chunks to an actor, 
something like:

class DemoActor extends Actor {
  implicit val mat = ActorMaterializer()

  override def receive: Receive = {
    case req: HttpRequest =>
       
      val source: Source[ChunkStreamPart, ActorRef] = Source.actorRef(10, 
OverflowStrategy.fail)

      sender() ! HttpResponse(entity = 
HttpEntity.Chunked(ContentTypes.`text/plain`, source))

                      val actorRef = "do something to get actorRef"

                      actorRef ! Chunk("Hello")
                      actorRef ! Chunk("World")
                      actorRef ! LastChunk()



  }
}

Could anyone help me on how to get the actorRef?


Thanks

Leon


-- 
>>>>>>>>>>      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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to