Created
May 31, 2015 08:45
-
-
Save rchatsiri/22197db09f26bb8ff191 to your computer and use it in GitHub Desktop.
Call Actor Akka
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * //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