Scalatra 2.1 Akka Futures Case Study

Does anyone know of a place where I could find an example of the classic chat application using Akka Futures with Scalatra 2.1? The Futures example in the documentation is a bit trivial, and since I'm brand new to Akka and relatively new to Scalatra, I wanted to start with a solid foundation. I know this can be tricky since Scalatra 2.1 is still officially under development.

+4
source share
1 answer

The chat example is very different from asynchronous requests.

An asynchronous request, like akka futures, is a request that ends and ends at the end. With an example chat, your request should resume / pause it essentially the comet.

with raw servlet 3.0 is as follows:

https://github.com/scalatra/scalatra/blob/2.1.x/example/src/main/scala/org/scalatra/Servlet30ChatExample.scala

Then you can use the akka acker to feed the message queue, etc. But the way we support akka futures on an asynchronization hit is a pause / end scenario, not a pause / resume / pause.

we also have an atmosphere / meteor example: https://github.com/scalatra/scalatra/blob/2.1.x/example/src/main/scala/org/scalatra/MeteorChatExample.scala

This is slightly less verbose than the servlet 3.0 example.

Hope this helps clarify the details a bit.

+5
source

Source: https://habr.com/ru/post/1399075/


All Articles