Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

REST API with Akka in Java

I am trying to create my own REST-based API using Java and Akka. I have created my main algorithmic implementation using Akka already. My confusion is coming in the form of how to implement the REST part of this. Most examples and libraries I have seen are specifically for Scala, which I am at the moment trying to stay away from.

I see Spray is a good way to go, but I see it's supposed to be for Scala. However, I know Scala compiles down to Java Byte Code and Java should be able to call Scala and visa versa. Is it possible to do this with Spray? If so, are there any working examples or tutorials online? I am not having any luck anywhere.

Thanks for your help and time.

like image 949
marothisu Avatar asked Jan 28 '13 19:01

marothisu


2 Answers

I would recommend you to use playframework 2.0. It is already integrated with akka and you can choose to write your code in Java or Scala. Its will be very easy to implement a REST-based API.

like image 87
billerby Avatar answered Oct 16 '22 09:10

billerby


Actually, I went down the same exact path: wanted to use Akka for REST-based services implementation and did not want to use Scala.

Akka can be used with Play-mini, which gives you the Sinatra-like REST mapping without any of the ui stuff (you don't need).

like image 42
Rob Avatar answered Oct 16 '22 10:10

Rob