Hi,

I am planning to use Akka Streams in web application. Below is my use case.

Whenever the request come to web server, I will do some operations like 
stg01, stg02 ...

*I have a below questions :- *

   - Do we need to close the streams after each request processed ?
   - If N multiple requests come, below invoke method will execute in N 
   times with parallel. In this case, how the actors will create and close ?
   

Below is the example code snippet :- 

  implicit val actorSystem = ActorSystem("Example")
  implicit val materializer = ActorMaterializer()
  implicit val executor = actorSystem.dispatcher
  val ll = scala.collection.mutable.ListBuffer[String]()
  ll += "123"; ll += "456"; ll += "789"
  invoke(ll.toList)
  
  def invoke(customerId: List[String]) {
    val source = Source(customerId)
    val sink = Sink.foreach[String] { x => display(x) }
    val stg01 = Flow[String].map { x => getStg01(x) }
    val stg02 = Flow[Int].map { x => getStg02(x) }

    *val runnable = source via stg01 via stg02 to sink*
    
  *  runnable.run*

  }
  def getStg01(request: String) = request.toInt
  def getStg02(request: Int) = request.toString
  def display(request: String) = println(" EVENT ===> " + request)
}

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

Reply via email to