Hi there,
in general the answer is somewhat along the lines of:
Because Akka is built from the ground up around asynchronous processing, it's a 
better match for building such systems.
If other tools "add some async stuff", yet it is not really the core of what 
they do you'll find some mismatches in APIs and styles eventually.

Btw, have you seen the akka-http routing DSL? 
http://doc.akka.io/docs/akka-stream-and-http-experimental/1.0/scala/http/routing-dsl/index.html#longer-example

You may enjoy this interview on a similar question as well: 
https://www.voxxed.com/blog/2015/07/akka-streams-and-http-1-0-final-release-is-here/

-- 
Cheers,
Konrad 'ktoso’ Malawski
Akka @ Typesafe

On 7 August 2015 at 13:33:26, akka...@gmail.com (akka...@gmail.com) wrote:

I'm an Akka beginner - so even if it's a stupid idea it would be great if I 
would know why.

Am Freitag, 7. August 2015 09:43:39 UTC+2 schrieb akk...@gmail.com:
I'm familiar with Apache CXF to build REST services. I implemented some Akka 
service which I want to expose via REST.

I know Akka has built akka-http but why should I use it if I can simply 
implement a REST service with Appache CXF and AsyncReponse? (See example below)

Any hint is welcome.


----- snip ----
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.HashMap;

@Path("/myService/{value}")
public class ExampleService {

    @Context ActorSystem actorSystem;
    LoggingAdapter log;

    @GET
    @Produces(MediaType.APPLICATION_JSON)
    public void getExamples (@PathParam("value") Integer value, final 
AsyncResponse res) {

        ActorSelection serviceActor = 
actorSystem.actorSelection("/user/serviceActor");

        Timeout timeout = new Timeout(Duration.create(2, "seconds"));

        Future<Object> future = Patterns.ask(serviceActor, value, timeout);

        future.onComplete(new OnComplete<Object>() {

            public void onComplete(Throwable failure, Object result) {
                 HashMap<String,Object> response = new HashMap<String,Object>();
                 response.put("results",result);
                 res.resume(Response.ok().entity(response).build());
            }
        }, actorSystem.dispatcher());
    }
}

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

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

Reply via email to