Skip to content

Instantly share code, notes, and snippets.

@rchatsiri
Created May 31, 2015 08:45
Show Gist options
  • Select an option

  • Save rchatsiri/22197db09f26bb8ff191 to your computer and use it in GitHub Desktop.

Select an option

Save rchatsiri/22197db09f26bb8ff191 to your computer and use it in GitHub Desktop.
Call Actor Akka
/*
* //Start actor completed.
//val malwareInfoList = malwareInfoActorCore ? MalwareInfoActorCore.WriteStreamMalwareInfo(malwareInfo)
*
//val resultListener = Await.result(malwareInfoList, 10 seconds);
//val resultMalwareInfoList = resultMalwareInfo ? resultListener
* //val malwareInfoListFuture = Await.result(malwareInfoList, 10 seconds).asInstanceOf[Future[List[MalwareInfo]]]
//Shutdown after select data.
//system.shutdown
// import scala.concurrent.ExecutionContext.Implicits.global
/*malwareInfoList.flatMap {
case malwareInfoListFuture: Future[List[MalwareInfo]] => malwareInfoListFuture.map {
mwlist =>
//Make model of JSON as JsValue
val mwlistJsObj = ConvertModelFormat.convertMalwareInfoToJson(mwlist)
//List[JsValue] converts to Enumerator
val mwlistEnumerator = Enumerator.enumerate(mwlistJsObj)
//Ref: https://github.com/reta/play-websockets-example/blob/master/app/controllers/Application.scala#L26
(Iteratee.ignore[JsValue], mwlistEnumerator)
//Ok.stream(mwlistEnumerator &> EventSource()).as("text/event-stream")
}
}*/
*/
/* Ref: http://stackoverflow.com/questions/14603790/how-to-get-an-enumeratort-from-listt-when-using-play-2-iteratees
* Ref: https://github.com/jroper/play-iteratees-extras/blob/master/src/main/scala/play/extras/iteratees/Json.scala
def convertJsontoEnumerator(jsObjectList : List[JsValue]): Enumerator[JsValue] = {
import scala.concurrent.ExecutionContext.Implicits.global
Enumerator.enumerate(jsObjectList)
}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment