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 [email protected]:
>
> 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 [email protected].
To post to this group, send email to [email protected].
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